|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-19 20:36 UTC] anthony dot parsons at manx dot net
[2004-05-23 02:33 UTC] anthony dot parsons at manx dot net
[2004-05-23 06:44 UTC] webmaster at script-tease dot net
[2004-06-12 21:37 UTC] anthony dot parsons at manx dot net
[2004-06-20 23:37 UTC] DelislMa at CollegeSherbrooke dot qc dot ca
[2004-09-08 05:48 UTC] curt@php.net
[2004-09-16 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 19:00:01 2025 UTC |
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> </p>"; echo "<p><h2>Upload image to Server.</h2></p> <p> </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.