I am starting to use dropzone.js and have run into a minor problem. I am able to upload files. I use a modal popup to get the file information.
The problem is when I go back the files I previously uploaded are still in the drop zone (with checkmarks). I want an empty dropzone.
Ideas?
dropzone has the following function for removing all files. If you want to remove all files, simply use . removeAllFiles(). Files that are in the process of being uploaded won't be removed.
Dropzone. js is 'a light weight JavaScript library that turns an HTML element into a "dropzone"'. Users can drag and drop a file onto an area of the page, uploading to a server. If you would like to read more how all of this works skim through the Dropzone.
All the answers I've seen involve assigning a variable when you initialize dropzone. If you don't want to do this extra step and already have your dropzone element: You can use Dropzone's forElement
method to directly target your dropzone without the need for any variables:
Dropzone.forElement('#myDropzoneElementID').removeAllFiles(true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With