TFS
TFS

Reputation: 1024

Dropzone - How can overwrite the previous upload when drop another file again

How can overwrite the previous upload when I drop another file again.

Example: Drag file A into the dropzone. It will uploaded file A. Then I drag file B into the same dropzone, it will removed file A (No need to remove from server side) and upload file B.

Upvotes: 0

Views: 2137

Answers (1)

H hao
H hao

Reputation: 77

you can assign a listener to the addedfile event, and handle this problem.

this.on("addedfile", function(file) { 
   // you code, maybe like below
   var files = myDropzone.getFilesWithStatus('success');
   if(files.length > 0 ){
      for(int i = 0; i < files.length ; i++){
           myDropzone.removeFile(files[i]);
      }
    }
 });

Upvotes: 2

Related Questions