I\'m implementing dropzone.js and everything is perfect until I try to upload multiple files with the same name, let\'s say uploading photos from an iOS device where all hav
The solution of @Hien works, but, the problem is when you upload 2 or more files with the same original name, because your for loop will match always the first image on the array, and will remove this element. but, this element is not necessarily the image that you want to remove...
I have added the "file.lastModified" property to your dropzone_files[], cause it seems to be unique. It works for me:
dropzone_files.push({'new_name': response, 'old_name': file.name, 'lastModified':file.lastModified});
And then, in your if condition:
if (file.name == dropzone_files[i]['old_name'] && file.lastModified==dropzone_files[i]['lastModified']) {/**/}
Note: I think lastmodify is unique, so, maybe another solution is: store lastmodify value with your img on your Database. Then, you could store this unique value in your removeData. Then, in your php, call the query "DELETE FROM images WHERE lastmodify=removeData";
For example...
Hope this help.