Multiple File Uploads Please

See all posts Reply

Multiple File Uploads Please new!
by Jablonski, 16 years, 4 months ago
I've been searching this forum and site for an hour. There are no clear cut to the point examples of how to upload multiple files with one submission..... With a GREAT class like this I don't understand how that wouldn't be something very easily done. I just want to upload 4 or 5 images at once. Can you help with actual examples of both the form and upload.php?Reply
Re: Multiple File Uploads Please new!
by colin, 16 years, 4 months ago
Look in the FAQ, the question What about multiple uploads?.

Basically, first have the form and your upload code working for one image. For instance, the name of your upload field (INPUT type file) will be my_field.

Then, duplicate your upload field, keeping the same name for each copy, but adding [] to the name. So you will have 5 fields named my_field[].

Then, use the code as is the FAQ. That code first reformats the $_FILES array, into an array of elements that you can feed to the upload class one by one. Create your loop, and apply the same settings for each file if you wish to.

I don't have the time to write a proper tutorial now, but I will add it to my to-do list...Reply
Re: Multiple File Uploads Please new!
by Jablonski, 16 years, 4 months ago
Thanks I figured it was something in the submit form. I'd seen the code in the faq but (obviously) it wasn't working because i just duplicated all the fields as "my_field" thinking $_FILES would know to put them in an array.

I'll try this now.Reply
Re: Multiple File Uploads Please new!
by Jablonski, 16 years, 4 months ago
Hey that worked flawlessly thanks.

I have one more question I'll start a new thread for.Reply