#28395 [NEW]: Uploading of files failure

From: Date: Fri, 14 May 2004 10:41:57 +0000
Subject: #28395 [NEW]: Uploading of files failure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59614@lists.php.net to get a copy of this message
From: si at bananas dot hopto dot org Operating system: Windows 2000 Apache2 PHP version: 5.0.0RC2 PHP Bug Type: *General Issues Bug description: Uploading of files failure Description: ------------ When uploading files, the first attempt will always fail, repeating the process (same script) it will upload ok. It seem that $_FILES is not getting filled with the filename of the upload or something around that. Reproduce code: --------------- if ($_POST[Submit] == "Upload") { $uploaddir = "c:\\program files\\apache group\\apache2\\htdocs\\images\\"; $uploadfile = $uploaddir . $_FILES['userfile']['name']; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "<h2><center>Upload Successful</center></h2>"; } else { sleep(2); $uploaddir = "c:\\program files\\apache group\\apache2\\htdocs\\images\\"; $uploadfile = $uploaddir . $_FILES['userfile']['name']; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "<h2><center>Upload Successful - Attempt 2</center></h2>"; } else { echo "<font face=\"Arial, Helvetica, sans-serif\"><h2> Upload Failed - Possible Bad File!</h2><p>&nbsp;</p>"; echo "<p><h2>Upload image to Server.</h2></p> <p>&nbsp;</p> <form action=\"$_SERVER[PHP_SELF]\" method=post enctype=\"multipart/form-data\"> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"90000\"> <p>File: <input type=FILE name=\"userfile\"></p> <input type=Submit name=\"Submit\" value=\"Upload\"> </form>"; } } } Expected result: ---------------- File to be uploaded on first attempt. Actual result: -------------- First upload will fail, second time it will suceed. -- Edit bug report at http://bugs.php.net/?id=28395&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28395&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28395&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28395&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28395&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28395&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28395&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28395&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28395&r=support Expected behavior: http://bugs.php.net/fix.php?id=28395&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28395&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28395&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28395&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28395&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28395&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28395&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28395&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28395&r=float

« previous php.bugs (#59614) next »