From: himself at zhwau dot net Operating system: Windows XP PHP version: 5.0.2 PHP Bug Type: Unknown/Other Function Bug description: HTTP POST file upload problem
Description: ------------ When trying to POST upload a file with the proper <FORM> tag, including the proper enctype and all (but without size restriction with MAX_FILE_SIZE as in manual example), the receiving script defined in ACTION results in move_uploaded_file() returning TRUE even though the file wasn't moved at all. Odd things happen when you try reloading the ACTION target page which makes Firefox repost the data - the second time around, the PHP script moves the file, even though it is assigned a different temp file name. Then everything works fine. Could this be the result of a write-behind process for the filesystem which makes move_uploaded_file() return true even if it didn't move the actual file? Reproduce code: --------------- <?php // The receiving script $ime = $_FILES['slika']['name']; if (move_uploaded_file($_FILES['slika']['tmp_name'], $ime)) { // Here i execute the code responsible for handling the file } else { // Report that the upload failed } ?> Expected result: ---------------- Should execute the 'ELSE' part of the sentence, since the move_upload_file() should return true in the case of a failed file move - unless it only detects whether or not the tmp_name file exists. Actual result: -------------- First time around, the move_uploaded_file() returns true (meaning the temp file exists) but the file isn't moved to $ime (i.e. the same dir where the script is executed). If you reload the page (and repost the same data), the tmp_name changes while all stays the same and the file is successfully moved. -- Edit bug report at http://bugs.php.net/?id=30924&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30924&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30924&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30924&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30924&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30924&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30924&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30924&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30924&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30924&r=support Expected behavior: http://bugs.php.net/fix.php?id=30924&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30924&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30924&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30924&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30924&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30924&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30924&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30924&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30924&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30924&r=mysqlcfg