Reputation: 26547
When an error happens, and maxFiles is set to 1, dropzone does not try to upload another file.
It somehow thinks it already have updated the file.
$(this.element).dropzone({
maxFiles: 1,
createImageThumbnails: false,
dictDefaultMessage: '',
clickable: true,
paramName: this.paramNameValue,
url: this.urlValue,
method: this.methodValue,
init: function() {
this.on("error", (fileObject, response) => {
let msg
try {
msg = JSON.parse(response).join(', ')
} catch (e) {
msg = response;
}
console.log('error', msg)
});
}
})
Upvotes: 0
Views: 1490
Reputation: 1
add maxFiles:1, in new Dropzone();
myDropzone.on("addedfile", function (file) {
for (var i = myDropzone.files.length - myDropzone.maxFiles -1; i >= 0; i--) {
var f = myDropzone.files[i];
if (f.upload.uuid !== file.upload.uuid)
myDropzone.removeFile(f);
}
});
Upvotes: 0
Reputation: 26547
As @DBS mentions I found the solution to be to manually remove the file.
This is how it looks:
$(this.element).dropzone({
// ....
init: this.on("error", (fileObject, response) => {
this.removeAllFiles();
// ...
});
}
})
Upvotes: 1