pekebyte / pekeUpload

jQuery html5 file uploader plugin
http://pekebyte.github.io/pekeUpload
Other
82 stars 73 forks source link

Multiple files in preview, but only one file is sent in post data. #32

Closed null-ref-0000 closed 7 years ago

null-ref-0000 commented 7 years ago

I am using the onSubmit option.

$("#files").pekeUpload({bootstrap: true, allowedExtensions:"jpeg|jpg|png|gif", onSubmit: true, dragMode: true});

When I check the post data sent I can see that only one file was sent.

Content-Disposition: form-data; name="files[images][]"; filename="index2.jpeg"

Content-Type: image/jpeg

pekebyte commented 7 years ago

Hi @keanesf thanks for using pekeUpload.

I actually tought that no one used this jQuery plugin these days. Actually, the onSubmit option sends all the files via ajax to the php script before the form submits, try to use the onFileSuccess function and append the data of the file to the form. Since this plugins uses XMLHttpRequest in order to upload the files via ajax, it can't be used with normal form post. You're probably getting the last file uploaded when you process the form because the plugin doesn't destroy the object.

null-ref-0000 commented 7 years ago

Ok, thanks for the advice. I actually changed my code to use another plugin since I wasn't able to get this to work as I required.