上传图像后清除dropzone.js缩略图 [英] Clear dropzone.js thumbnail image after uploading an image

查看:90
本文介绍了上传图像后清除dropzone.js缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在mvc中使用dropzone.js了解了这个教程用于上传图片,但在上传图片后,缩略图仍然显示,我需要在每次上传图片后将其删除。

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.

我试图在使用jQuery上传图像后替换生成的HTML但是它没有正确显示,因为我第一次需要刷新页面才能正确显示但我不想这样做。

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>');


推荐答案

你可以试试这个:

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

此处提供更多信息:
http://www.dropzonejs.com/#dropzone-methods

这篇关于上传图像后清除dropzone.js缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆