Fadi Fadi - 2 years ago 152
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" />'

thank for any help in advance

Answer Source

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 () {

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download