#10307 [Opn->Csd]: PHP refusing to get temporary file name from an HTTP PUT request.
| From: | pollita@php.net | Date: | Mon, 02 Dec 2002 06:00:50 +0000 |
| Subject: | #10307 [Opn->Csd]: PHP refusing to get temporary file name from an HTTP PUT request. | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969350087@lists.php.net to get a copy of this message | ||
ID: 10307
Updated by: pollita@php.net
Reported By: excalibur@hub.org
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: freebsd 4.2
PHP Version: 4.2.1
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Provided example of using php://stdin and note re: Changed behavior
from PHP3.
Previous Comments:
------------------------------------------------------------------------
[2002-08-26 00:40:48] alan@akbkhome.com
I couldnt get PUT to work like that, looks like this patch will solve
it.
http://marc.theaimsgroup.com/?l=php-dev&m=102983806024466&w=2
(read the following responsed for a bit more detail on why php cant
read PUT at present)
regards
Alan
------------------------------------------------------------------------
[2002-08-25 20:14:11] wez@php.net
Making this a Documentation Problem; I can't find any code
that sets PHP_UPLOADED_FILE_NAME, PHP_PUT_FILENAME or
other variations, so it seems that the docs at
http://www.php.net/manual/en/features.file-upload.put-method.php
are just plain wrong.
However, it does seem that fopen("php://stdin", "rb") will
allow access to that data (but I haven't tried to verify this).
------------------------------------------------------------------------
[2002-08-25 19:57:56] wez@php.net
Sounds like the data is ending up coming from stdin;
try the following code:
$data = fopen("php://stdin", "rb");
$destfile = fopen("file_to_overwrite", "wb");
while(!feof($data)) {
$chunk = fread($data, 4096);
fwrite($destfile, $chunk);
}
fclose($destfile);
fclose($data);
This doesn't explain why it doesn't behave as documented,
but should be enough to get you going.
------------------------------------------------------------------------
[2002-08-25 12:40:18] vvs_php@nsrd.sinp.msu.ru
PUT method is used for publishing from HTML editors.
But apache brings the data to the script to the stdin stream.
So, PHP does not accept any data. And, also, does not set up
any variable on that score.
------------------------------------------------------------------------
[2002-08-13 22:43:27] kalowsky@php.net
updating version as per user comments.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/10307
--
Edit this bug report at http://bugs.php.net/?id=10307&edit=1