From: npandey2 at sapient dot com Operating system: Windows Server 2003 PHP version: 5.2.6 PHP Bug Type: Filesystem function related Bug description: File Upload does not work after upgarde from 4.X
Description: ------------ We upgraded out Data Hosting platform from PHP Version 4.4.2 to 5.2.6 and after that the script to upload files keeps failing. The relevent settings in PHP.ini file open_basedir = NOT Set safe_mode = On file_uploads = On upload_tmp_dir = C:\Windows\Temp Cannot submit URL as the installation is curerntly at the integration environment Reproduce code: --------------- PHP Script : <html> <head><title>DataUpload per PHP</title></head> <body> <? $file_dir = "./files/"; $userfile = $_FILES['userfile']['name']; $tmp = $_FILES['userfile']['tmp_name']; $err = $_FILES['userfile']['error']; $size = $_FILES['userfile']['size']; echo "phpversion: " . phpversion() . "<br />"; echo "fileuploads: " . get_cfg_var('file_uploads') . "<br />"; echo "upload_tmp_dir: " . get_cfg_var('upload_tmp_dir') . "<br />"; echo "file_dir: " . $file_dir . "<br />"; echo "userfile: " . $userfile . "<br />"; echo "tmp :" . $tmp . "<br /><br />"; if ($_POST['submit'] == "Senden") { if ($_FILES["file"]["error"] > 0){ echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } elseif (file_exists($file_dir.$userfile)) { die ("File does not exists!"); } elseif (move_uploaded_file($tmp, $file_dir.$userfile)) { die ("Data file $userfile copied"); } else{ die ("Data Upload failed!"); }} else { ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <h3>Data File: <input name="userfile" type="file" /> </h3> <input type="submit" name="submit" value="Senden" /> </form> <?php } ?> </body> </html> Expected result: ---------------- PHP Script : phpversion: 5.2.4 fileuploads: 1 upload_tmp_dir: C:\Windows\Temp file_dir: ./files/ userfile: 2.txt tmp :C:\WINDOWS\Temp\php8487.tmp Data file 2.txt copied Actual result: -------------- PHP Script : phpversion: 5.2.4 fileuploads: 1 upload_tmp_dir: C:\Windows\Temp file_dir: ./files/ userfile: 2.txt tmp : Return Code: 6 Data Upload failed! -- Edit bug report at http://bugs.php.net/?id=46150&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46150&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46150&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46150&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46150&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46150&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46150&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46150&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46150&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46150&r=support Expected behavior: http://bugs.php.net/fix.php?id=46150&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46150&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46150&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46150&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46150&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46150&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46150&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46150&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46150&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46150&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46150&r=mysqlcfg