this is what i have in process.php
parse_str(file_get_contents(\"php://input\"),$upload_data);
if (isset($upload_data)) {
print_r($upload_data);
exit;
}
The only way in your situation is to parse raw request manually (look at this gist)
parse_str(file_get_contents("php://input"), $_PUT);
The $_FILES array being populated on PUT requests. That's because a PUT request will specify the file name in the url and the file content in the body. Nothing more.
You'll have to use php://input
as you already suggested.
upload.php
<?php
/* PUT data goes to php://input */
echo file_get_contents("php://input");
Then use the following curl command line:
curl --upload -H "X-TOKEN: test123" a.txt http://localhost/upload.php
Update after comments: Using the --upload option should fit your needs. In difference to -X PUT together with -F, the data will be send raw and get not multipart/form-data encoded.. One of the hidden treasures of curl ;)