Clear Dropzone.js Thumbnail Image After Uploading An Image
Answer :
You can try this:
myDropzone.on("complete", function(file) { myDropzone.removeFile(file); });
More information here: http://www.dropzonejs.com/#dropzone-methods
removeAllFiles()
and removeFile()
will trigger the server-side removal too, if you hooked Dropzone to remove files as well.
The solution to clear it only client-side, remove the file preview, and if you had a blank state message, remove the dz-started
class to prevent the Dropzone CSS from hiding it:
$('.dropzone')[0].dropzone.files.forEach(function(file) { file.previewElement.remove(); }); $('.dropzone').removeClass('dz-started');
Another option (similar to answer of Giraldi, but then when all files are completed):
myDropzone.on("queuecomplete", function () { this.removeAllFiles(); });
Comments
Post a Comment