Page 1 of 1
Uploading Multiple Files
Posted: Tue Jul 01, 2003 10:39 am
by kendall
Hello,
Can i upload multiple files?
i have a form with the file fileds id = file[1], file[2], file[3] etc...
im trying to access the $_FILES['file'][1]['name'] but i dont get anything
Kendall
Posted: Tue Jul 01, 2003 11:56 am
by daven
try this:
A) <input type="file" name="localfile[]"> (if you are using a loop to create the lines)
B) $_FILES['localfile']['name'][$idx] // put the counter at the end of the variable
Uploading Multiple Files
Posted: Tue Jul 01, 2003 12:05 pm
by kendall
thanks Deven
Posted: Tue Jul 01, 2003 12:07 pm
by kendall
oh just one more thing... at the end of it all i do a unlink($_FILE['file']['tmp_name']); but i get an error...what gives? are temp files automatically delete after a move_uploaded_file()?
Posted: Tue Jul 01, 2003 12:56 pm
by pootergeist
yup - move_uploaded_file actually moves the file - it doesn't copy it and move the copy (unlike copy).
it will only work on files uploaded through the $_FILES array as well, thus is more secure than copy+unlink.