[SOLVED] file upload error ($_FILE)
Posted: Thu Sep 16, 2004 2:21 pm
For some reason, when i try and upload a file, the $_FILE or $HTTP_POST_FILE array holds the info, but i can't extract it. It works fine when i am only uploading 1 file @ a time, but errors (and by error i mean, nothing is printed) with multiple. I'll expalin..
here is a snipet of code i am using to test the file upload
the HTML form code..
when the form is submitted, the first echo line is printed ("the files.."), but thats it. Nothing happens with the rest. I am selecting files and I know they are in there when i do a print_r() on the array.
For some odd reason, it prints nothing wnen i use the [$x].
any ideas why this happens?
here is a snipet of code i am using to test the file upload
Code: Select all
$num_files = count($_FILES['IMG']['name']);
for($x = 0; $x < $num_files; $x++)
{
echo "the files you picked are...<br>";
echo $_FILES['IMG']['name'][$x];
}Code: Select all
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" /><br>
File:<input name="IMG" type="file" /> <br>
File:<input name="IMG" type="file" /> <br>
File:<input name="IMG" type="file" /> <br>
File:<input name="IMG" type="file" /> <br>
...
<input type="submit" value="Upload Files" />
<form>For some odd reason, it prints nothing wnen i use the [$x].
any ideas why this happens?