php multiple file upload oddity
[SOLVED] dont ask me how i have no idea, i didnt change anything but the names of the 2 form file inputs from uploadedfile and fuploadedfile to abc and abc2 and now it works, im as confused as you.
ok, i have 2 file inputs one called 'uploadedfile' the other called 'fuploadedfile' i have a function i call to upload a file, which if tested on a single file works
uploadfile($_FILES["uploadedfile"]);
works
uploadfile($_FILES["fuploadedfile"]);
does not
i have tacked this to the end of the upload script to see what happens
echo var_dump($_FILES["uploadedfile"]);
echo var_dump($_FILES["fuploadedfile"]);
EDIT: this is what i get from each uploadedfile:
array(5) { ["name"]=> string(7) "cat.gif" ["type"]=> string(9) "image/gif" ["tmp_name"]=> string(24) "C:\xampp\tmp\php59F9.tmp" ["error"]=> int(0) ["size"]=> int(14328) }
and this is what i get from fuploadedfile:
NULL
the first one prints out an array full of information relative to the uploaded file, which is good. the second one gives me some "Undefined index" error, im uploading the same file via the same script, the only thing thats different is that ive called the second one a diffe开发者_如何学运维rent name which shouldnt effect the upload script because it uses a dynamic variable.
here's the upload script - http://pastebin.com/vkcZEmXp
Why is it doing this?
EDIT: this is pretty much the HTML form (sans the other random inputs), but i don't think it's the problem because the upload has worked for the first one.
<form name="mainform" id="mainform" enctype="multipart/form-data" action="uploader.php" method="POST">
<input name="uploadedfile" type="file" />
<input name="fuploadedfile" type="file" />
<input class="formbtn" type="submit" value="Submit">
</form>
I don't even know what the actuall issue was, but seems like my advices helped ;-)
As a test; try using the HTML exactly as you have posted it in your question. I suspect there's an error in a different part of your HTML form.
I've tried your uploader.php exactly as you wrote it, together with a HTML page consisting of only of your form. I cannot reproduce your problem -- both files upload correctly although on my server I need to give a fully qualified path for $uploaded_target
精彩评论