ProgerXP / FileDrop

Self-contained cross-browser pure JavaScript class for Drag & Drop and AJAX (multi) file upload.
filedropjs.org
The Unlicense
264 stars 61 forks source link

iOS multiple file upload broken #30

Closed julienmru closed 9 years ago

julienmru commented 9 years ago

I encountered an issue with multiple file upload on iOS reproduced on the online demo. Although I can choose several files, only one is uploaded. Please find the debug:

ios simulator screen shot 13 nov 2014 12 30 28

The script https://blueimp.github.io/jQuery-File-Upload/ has not such issue so I believe it's not a iOS limitation.

julienmru commented 9 years ago

I fixed quickly the issue by changing on line 1513:

          // Safari Windows adds first file several times so skip them.
          if (!names[file.name]) {

to

          // Safari Windows adds first file several times so skip them.
          if (true || !names[file.name]) {

You might want to improve the check a little more :)

ProgerXP commented 9 years ago

if (true || !names[file.name]) {

Wait, does iOS upload multiple files under the same name (file.name = local file name)? Can you give me list of file names that Safari passes to this piece of code (e.g. insert alert(file.name) before this check)?

Assuming it does, how do you differentiate between the uploaded files (client side or server side)?

julienmru commented 9 years ago

@ProgerXP: all files are passed as "image.jpg" on iOS.

ProgerXP commented 9 years ago

@ProgerXP: all files are passed as "image.jpg" on iOS.

Duh. Okay, fixed it with:

if (!names[file.name] || file.name == 'image.jpg') {

Please test if it works.

Also, on which iOS version you've tested FileDrop? 6, 7, 8? I'm going to add this info to support list if it works there as well.

julienmru commented 9 years ago

It works on iOS 7 and 8.

ProgerXP commented 9 years ago

Great. If my fix works - please close this issue.