Deleting a form of downloaded Dropzone.js form files

I use dropzone.js for my project, and I need to delete the files from the plugin download area (and not from the server) after downloading them. I need to go back to “Drop files here or click to download” after downloading.

I try to get the same result that I get when I use the "Delete file" link under the file icon. But when I try to achieve this programmatically, removeFileEventit will not start.

I tried both jquery trigger('click');and dispatchEvent(event);.

My code is:

 var dropzone = new Dropzone('#uploadzone', 
    {
       url: 'uploaded_url.php',
       addRemoveLinks: true,
       init: function () 
       {
           this.on("success", function (file, response) 
           {
              var removeLink = $(file.previewElement).find('a.dz-remove');
              removeLink.trigger('click');
           });
       }
    );
+4
source share
1 answer

You can use the API specified by dropzone

dropzone.removeFile(file)

+2

Source: https://habr.com/ru/post/1620269/


All Articles