|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-08-11 10:39 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2020-08-11 10:39 UTC] cmb@php.net
[2020-08-23 04:23 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
Description: ------------ File upload under Apache 2.2.8 and 2.2.11 produces an empty temporary file name and an UPLOAD_ERR_NO_TMP_DIR error in $_FILES[<userfile>]['error']. In the case of the machine concerned, Apache and PHP run off the D: drive whereas the temporary directories reside under C:. Rebooting the entire system sometimes resolves the problem temporarily, but it then reappears. This does not always work, however. Repeat "uploads" occasionally cause the server to crash. Setting the temporary directory explicitly using upload_tmp_dir provides a workaround. Default windows system tmp dir variables are set as: TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP Reproduce code: --------------- <?php if (count($_FILES) > 0) { echo "<h1>Response page</h1>"; echo "<h2>\$_ENV</h2>"; foreach ($_ENV as $name => $value) echo $name."=".htmlentities($value)."<br/>"; echo "<h2>\$_FILES</h2>"; foreach ($_FILES["myFile"] as $fileProperty => $filePropertyValue) { echo $fileProperty."=".$filePropertyValue."<br>"; } } else { ?> <h1>Form</h1> <form action="fu.php" method="post" enctype="multipart/form-data"> Please enter a file: <input type="file" name="myFile"> <input type="submit" value="Submit file for processing"> </form> <?php } ?> Expected result: ---------------- $_ENV ... TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP ... $_FILES name=figure1-e.pdf type=application/pdf tmp_name=C:\WINDOWS\Temp\php981.tmp error=0 size=50452 Actual result: -------------- $_ENV ... TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP ... $_FILES name=figure1-e.pdf type= tmp_name= error=6 size=0