note 128423 added to features.file-upload.put-method
| From: | polygon dot co dot in at gmail dot com | Date: | Sun, 23 Apr 2023 09:11:59 +0000 |
| Subject: | note 128423 added to features.file-upload.put-method | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220378@lists.php.net to get a copy of this message | ||
I was confused with file uploads using the PUT method.
My concern was why can't we upload multiple files using the PUT method with streams
PUT data comes in on the stdin stream
$putdata = fopen("php://input", "r");
Note the $putdata is a file pointer to the file content that is being uploaded.
The data is received on the server on the fly (which means available as it is received)
Secondly, when we are using parse_str(file_get_contents("php://input")).
This means the data is completely received on the server end and is then made available to the
script.
When using fopen() one cant parse the data. This can be used when uploading a large file.
The file may range from 100's of MBs to Gigs where streams plays a major role.
Streams make the file data available to script in chunks instead of first saving in the temp folder.
Hence, when using $putdata = fopen("php://input", "r"); one can't pass the
payload as well.
If someone wants to pass the payload the only option is in the URL query string.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 203.192.195.220)
----
Manual Page -- https://php.net/manual/en/features.file-upload.put-method.php
Edit -- https://main.php.net/note/edit/128423
Del: integrated -- https://main.php.net/note/delete/128423/integrated
Del: useless -- https://main.php.net/note/delete/128423/useless
Del: bad code -- https://main.php.net/note/delete/128423/bad+code
Del: spam -- https://main.php.net/note/delete/128423/spam
Del: non-english -- https://main.php.net/note/delete/128423/non-english
Del: in docs -- https://main.php.net/note/delete/128423/in+docs
Del: other reasons-- https://main.php.net/note/delete/128423
Reject -- https://main.php.net/note/reject/128423
Search -- https://main.php.net/manage/user-notes.php