I am using Dropzone. I'd like to prevent the uploading of a file which already exists as thumbnail in Dropzone "panel". With uploading I mean not to allow a file with the same name to be shown twice in the panel. I do not care about the case of the file already existing in the server and not showing in the panel, since it will be replaced by the new one with the same name.
I cannot find how to achieve that despite my efforts. I'd appreciate your help.
Thank you very much
Add these simple lines of code:
myDropzone.on("addedfile", function(file) {
if (this.files.length) {
var _i, _len;
for (_i = 0, _len = this.files.length; _i < _len - 1; _i++) // -1 to exclude current file
{
if(this.files[_i].name === file.name && this.files[_i].size === file.size && this.files[_i].lastModifiedDate.toString() === file.lastModifiedDate.toString())
{
this.removeFile(file);
}
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With