From:             ulrich at cs dot auckland dot ac dot nz
Operating system: Win XP Pro
PHP version:      5.2.9
PHP Bug Type:     *Web Server problem
Bug description:  System TMP dir ignored in file uploads

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 bug report at http://bugs.php.net/?id=47681&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47681&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47681&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47681&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47681&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47681&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47681&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47681&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47681&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47681&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47681&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47681&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47681&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47681&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47681&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47681&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47681&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47681&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47681&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47681&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47681&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47681&r=mysqlcfg

Reply via email to