Fadi Fadi - 7 months ago 17
Javascript Question

clear dropzone thumbnail image after uploading an image

i have using dropzone 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 try 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>');


thank for any help in advance

Answer

it was actually an easy thing to do but some time it go hard so i just delete the dropzone generated code using jquery and add a button with 'id = btnCreate' then

 $('#btnCreate').click(function () {
        $('div.dz-success').remove();
   });

and when i upload the thumbnail image removed after i click the button