|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-04-12 13:17 UTC] excalibur at hub dot org
I am using PHP 4.04pl1 on a FreeBSD 4.2 based system with Apache 1.3.19. I have a page that is "accepting" HTTP PUT requests and is supposed to save the file in a designated area, however PHP is not picking up the temporary filename while the script runs. All other variables required are set, but not $PHP_PUT_FILENAME. I have tried all recommendations in the docs, mailing list and IRC channels. None have worked. I do notice that the protocol level is HTTP 1.0 PUT not HTTP 1.1 PUT, I have not been able to determine if that is the issue. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 16:00:01 2025 UTC |
This is a copy of all the versions we tried, none of them worked in the slightest. <?php // copy($PHP_PUT_FILENAME,$DOCUMENT_ROOT.$REQUEST_URI); $fp = fopen("/home/vhosts/farelist.com/www/update/log.txt","w+"); if(!copy ($PHP_PUT_FILENAME, "/home/vhosts/farelist.com/www/update/test.txt")) { fwrite($fp, "\n\ncopy failed\n\n"); } else { fwrite($fp, "\n\ncopy successful\n\n"); } $temp="PHP_PUT_FILENAME: $PHP_PUT_FILENAME\n"; $vars = get_defined_vars(); foreach ($vars as $test => $value) { if (is_array($value)) { foreach ($value as $subtest => $subvalue) { $temp .= "$subtest: $subvalue\n"; } } else { $temp .= "$test: $value\n"; } } fwrite($fp, $temp); $temp="DOCUMENT_ROOT: $DOCUMENT_ROOT\n"; fwrite($fp, $temp); $temp="REQUEST_URI: $REQUEST_URI\n"; fwrite($fp, $temp); fclose($fp); ?>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.