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 class supports multiple uploads, check the faq, section called What about multiple uploads?.
That said, the actual widget to upload several files at the same time is a client-side problem. You can use the class with any upload system, multiple or not. In other words, the class deals with the upload, not with the upload form.Reply
I am not sure why you have an error. In any case, the error 4 UPLOAD_ERR_NO_FILE means that no file has been uploaded. The class cannot do anything if no file has been uploaded, and is not even activated. Check if uploads work properly on your server., without the class. Then use the class.Reply
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:
Right, that's what I thought... Now that's working perfectly...
Thank you so much for your help.
Otherwise here is a link to a multiple selection solution; http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/ it's opensource and I think that's completing your uploading class...Reply
I really like your job; this class is useful and working perfectly...
Just a suggestion:
Do you think that could be possible to allow a multiple selection of files, aiming a multiple upload?
It could be really useful in many cases;
I know Google is doing this in Gmail, but maybe it's difficult to program...
Thanks!
That said, the actual widget to upload several files at the same time is a client-side problem. You can use the class with any upload system, multiple or not. In other words, the class deals with the upload, not with the upload form.
I thought I checked the FAQ...
Otherwise the code :
Seems to be buggy... Executing it always give me an error on the line:
foreach ($l as $i => $v) {
The server is running PHP version 5.2
Do you have any idea?
Thanks
I should have been done by myself...
Here is the content of the array :
Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
I think this error is finally due to my field...
It's still a simple form:
What should I use here?
Thanks!
Are you sure your form tag has the property enctype="multipart/form-data"?
Do you want me to upload my entire source code?
(Translated in HTML)
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:
Now that's working perfectly...
Thank you so much for your help.
Otherwise here is a link to a multiple selection solution;
http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/
it's opensource and I think that's completing your uploading class...