class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
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:
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?
Thanks
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: