最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Dropzone.js: how to cancel uploads when dropping new file - Stack Overflow

matteradmin5PV0评论

Using Dropzone.js I need to implement a way when a user drop a file into Dropzone all current uploads (if any) are canceled so only the current one gets uploaded.

I need a way to select and delete those.

I can do MyDropzone.processQueue to get the uploading queue files. I can also do MyDropzone.removeAllFiles() but this removes all items (uploading or uploaded).

I don't understand how can I apply the removeAllFiles() method only to the files that are in MyDropzone.processQueue.

Any idea how to acplish this?

Using Dropzone.js I need to implement a way when a user drop a file into Dropzone all current uploads (if any) are canceled so only the current one gets uploaded.

I need a way to select and delete those.

I can do MyDropzone.processQueue to get the uploading queue files. I can also do MyDropzone.removeAllFiles() but this removes all items (uploading or uploaded).

I don't understand how can I apply the removeAllFiles() method only to the files that are in MyDropzone.processQueue.

Any idea how to acplish this?

Share Improve this question edited Apr 15, 2013 at 7:16 Charles 51.5k13 gold badges106 silver badges144 bronze badges asked Apr 14, 2013 at 22:15 MartinMartin 11.3k23 gold badges86 silver badges143 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 1

The latest version of Dropzone provides methods for this, as well as a addRemoveLinks option that inserts links to cancel/remove uploads.

Try:

Dropzone.autoDiscover = false;
$("#mydropzone").dropzone({
    init: function() {
        var $this = this;
        $("button#clear-dropzone").click(function() {
            $this.removeAllFiles(true);
        });
    }
});
Post a comment

comment list (0)

  1. No comments so far