I am using dropzone.js for my drag-drop file upload solution. I want to upload only one file,if i upload second file the first one should be remove and second one should be uplo
I used event maxfilesexceeded
with method addFile
and rans into infinite loop of event call. It should be the problem of using addFile
because I didn't see it mentioned in both official site or GitHub wiki. Finally I solved with addedfile
event. The Dropzone.js is the latest version when I write (4.3.0).
init: function() {
this.on('addedfile', function(file) {
if (this.files.length > 1) {
this.removeFile(this.files[0]);
}
});
}