LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

Wrong multipart submission #102

Closed alex-burak closed 8 years ago

alex-burak commented 9 years ago

When sending files with "multipart: true" setting, form submitted looks like this: Content-Disposition: form-data; name="filename"

myfile.txt -----------------------------79001742426903 Content-Disposition: form-data; name="filename"; filename="myfile.txt" Content-Type: application/vnd.ms-excel

Why on Earth you put two parts under the same name??? Look at examples at http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 ! In general - guys, I spent 2 hours to make it "almost" work encountering issue after issue - and you promise "simple" ajax uploader that actually can hardly work properly?
djFFFFF commented 9 years ago

I got the same problem after updating Simple-Ajax-Uploader. I am using Python and got a list of two items with request.get_form_var("image_file"). It should only be the file and it worked before.

It should be:

------WebKitFormBoundaryo0LnhAZmbT54DaqP
Content-Disposition: form-data; name="image_file"; filename="C215A847-8449-4669-BC05-743647197075.png"
Content-Type: image/png

------WebKitFormBoundaryo0LnhAZmbT54DaqP--

but I got:

------WebKitFormBoundaryAGUUhkaUJwvP1Pd9
Content-Disposition: form-data; name="image_file"

C215A847-8449-4669-BC05-743647197075.png
------WebKitFormBoundaryAGUUhkaUJwvP1Pd9
Content-Disposition: form-data; name="image_file"; filename="C215A847-8449-4669-BC05-743647197075.png"
Content-Type: image/png

------WebKitFormBoundaryAGUUhkaUJwvP1Pd9--
eubyte commented 9 years ago

When uploading multiple files (multiple: true), even when setting 'multipart: true', the uploader is making one POST call per each file instead of just ONE call. Am I doing something wrong?

LPology commented 8 years ago

@ygr2013 @subrays I know this is way late, but it just occurred to me how this is happening. To fix it, either upgrade to version 2.4 (which fixes the issue), or set noParams: true in your JS settings.

@eubyte You are not doing anything wrong, that is correct -- each file is uploaded individually. I'm looking into an update that will allow multiple files in one upload request.