Here is the solution I came to:
Add these two options in your Dropzone initialization
dictDuplicateFile: "Duplicate Files Cannot Be Uploaded",
preventDuplicates: true,
and add one more prototype function and re-implement your dropzone addFile
prototype function above dropzone initialization like this:
Dropzone.prototype.isFileExist = function(file) {
var i;
if(this.files.length > 0) {
for(i = 0; i < this.files.length; i++) {
if(this.files[i].name === file.name
&& this.files[i].size === file.size
&& this.files[i].lastModifiedDate.toString() === file.lastModifiedDate.toString())
{
return true;
}
}
}
return false;
};
Dropzone.prototype.addFile = function(file) {
file.upload = {
progress: 0,
total: file.size,
bytesSent: 0
};
if (this.options.preventDuplicates && this.isFileExist(file)) {
alert(this.options.dictDuplicateFile);
return;
}
this.files.push(file);
file.status = Dropzone.ADDED;
this.emit("addedfile", file);
this._enqueueThumbnail(file);
return this.accept(file, (function(_this) {
return function(error) {
if (error) {
file.accepted = false;
_this._errorProcessing([file], error);
} else {
file.accepted = true;
if (_this.options.autoQueue) {
_this.enqueueFile(file);
}
}
return _this._updateMaxFilesReachedClass();
};
})(this));
};
You can also modify your drozone file if you want.