tags:

views:

122

answers:

3

How do I receive an uploaded file from WGET in PHP?

wget --post-file=file.txt --header="Content-type: text/csv" "http://mywebsite.com/upload.php"

In which variable do I find the contents of file.txt?

+1  A: 

Uploaded files should be accessible via the $_FILES array.

http://php.net/manual/en/reserved.variables.files.php

http://www.php.net/manual/en/features.file-upload.post-method.php

Note that this array doesn't actually contain the files themselves... rather, it contains metadata about them, including the temporary location where the file has been stored on your server. So, if you wanted to get the location of a file uploaded to the form field "file1", you could access it like so:

$location = $_FILES['file1']['tmp_name'];

Then you could use PHP's file_get_contents() function to read and process data in the file.

Hope this helps!

Matt
A: 

Not sure what you are asking for here but file_get_contents is usually the standard way to do this. http://php.net/manual/en/function.file-get-contents.php

Gaurav Gupta
A: 

Finally, the answer was: $HTTP_RAW_POST_DATA

Gerardo