Clear dropzone.js thumbnail image after uploading an image

ajax, asp.net-mvc, dropzone.js, javascript, jquery

Solution

You can try this:

myDropzone.on("complete", function(file) {
  myDropzone.removeFile(file);
});

More information here: http://www.dropzonejs.com/#dropzone-methods

Problem

I have using dropzone.js in mvc by following this tutorial for uploading images but after uploading the image the thumbnail image still showing and I need it to be removed after every time I upload an image. I have tried to replace the generated HTML after uploading the image using jQuery but it not showing correctly as the first time I need to refresh the page to show correctly but I don't want to do that. ``` $("#ImageUpload").replaceWith('<form action="/Products/SaveUploadedFile" method="post" enctype="multipart/form-data" class="dropzone dz-clickable" id="dropzoneForm">' +'<div class="fallback">' +'<input name="file" type="file" multiple />' +'<input type="submit" value="Upload" />' +'</div>'); ```

Original source