Bug #47681 [Opn->Fbk]: System TMP dir ignored in file uploads
Edit report at https://bugs.php.net/bug.php?id=47681&edit=1
ID: 47681
Updated by: cmb@php.net
Reported by: ulrich at cs dot auckland dot ac dot nz
Summary: System TMP dir ignored in file uploads
-Status: Open
+Status: Feedback
Type: Bug
Package: Apache2 related
Operating System: win32 only - Win XP Pro
PHP Version: 5.2.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I cannot reproduce the reported behavior with current PHP-7.3
running via mod_php. Can anybody else reproduce this with any of
the actively supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2009-03-16 23:00:31] ulrich at cs dot auckland dot ac dot nz
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=47681&edit=1
Thread (3 messages)