Multiple selection / multiple upload

See all posts See thread Reply

Re: Multiple selection / multiple upload new!
by Mdc888, 15 years ago
Yeah, sorry about that; This problem is now solved :
Array ( [name] => DSC_0003.JPG [type] => image/jpeg [tmp_name] => /var/log/tmp/phpPXNx11 [error] => 0 [size] => 3549618 )

BUT I still have the same problem :
Warning: Invalid argument supplied for foreach() in xxx.php on line 117

Talking about something else: how could you select multiple files with the normal input form?

ThanksReply
Re: Multiple selection / multiple upload new!
by colin, 15 years ago
The foreach() loops are to be used only if you have multiple upload fields.

In your case, you have only one field my_field. You can instanciate the class directly without looping through the $_FILES array.

If you want multiple upload fields, you need to have several fields in your form, and then you will have to loop through $_FILES as in the FAQ. To have several fields, you would need to have something like this in your form:
<input type="file" size="32" name="my_field[]" value="" />
<input type="file" size="32" name="my_field[]" value="" />
<input type="file" size="32" name="my_field[]" value="" />
Reply