Ok, i did a little test script, you can check, the browser sends to the server a request body, but var_dump(file_get_contents('php://input')) // string(0) ""
Do not forget to select a file to upload. <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { var_dump(file_get_contents('php://input')); exit; } ?><html> <body> <form method="POST" enctype="multipart/form-data"> <input type="file" name="file"> <hr> <button>POST</button> </form> </body> </html> 2014-10-16 0:14 GMT+03:00 Ralph Schindler <ra...@ralphschindler.com>: >>> I'm not sure I understand what you're trying to do, could you explain in >>> more detail with examples? >> >> >> PUT /url >> Content-type: application/x-www-form-urlencoded >> >> parse_str (file_get_contents(‘php://input'), $_POST) // Ok >> >> PUT /url >> Content-type: multipart/mixed; boundary="xxxx" >> >> file_get_contents(‘php://input') // Empty string > > > You are missing information in your example. First, PHP doesn't do content > negotiation for every Content-Type known to send serialized data, it is > extremely selective in that AFAIK, url/form encoded Content-Types, when > POSTed, will be content-negotiated, parsed, and their resultant will > populate the $_POST superglobal. > > Moreover, your 2nd example does not suggest that an HTTP request was sent > with a body to demonstrate there is a bug here. > > With a php script being served at index.php with the following contents: > > <?php > var_dump(file_get_contents('php://input')); > > Here is a demonstration of this script, and a successful read of the request > body: > > $ echo 'FOOOO=BARRRRR' | http --verbose PUT localhost:8000 \ > Content-Type:'multipart/mime; boundry=xxxxx' > > PUT / HTTP/1.1 > Accept: application/json > Accept-Encoding: gzip, deflate > Content-Length: 14 > Content-Type: multipart/mime; boundry=xxxxx > Host: localhost:8000 > User-Agent: HTTPie/0.8.0 > > FOOOO=BARRRRR > > HTTP/1.1 200 OK > Connection: close > Content-type: text/html > Host: localhost:8000 > X-Powered-By: PHP/5.5.15 > > string(14) "FOOOO=BARRRRR > " > > > -ralph > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php