Sum*_*tel 2 jquery dropzone.js
注意:我厌倦了与此主题相关的所有问题和答案。
我想删除 dropzone 中的当前上传文件。alert('i remove current file');我设置了最大大小,任何人都可以上传超过 siz 的文档,然后在这次删除。
我的代码 在这里
wal*_*876 11
要从 dropzone 中删除文件,您只需调用该removeFile()方法,最简单的方法是使用闭包。
var myDropzone = new Dropzone("#mydropzone", {
url: "/file/post",
acceptedFiles: accept,
maxFilesize: 0.5,
uploadMultiple: false,
createImageThumbnails: false,
addRemoveLinks: true,
maxFiles: 3,
maxfilesexceeded: function(file) {
this.removeAllFiles();
this.addFile(file);
},
init: function() {
var drop = this; // Closure
this.on('error', function(file, errorMessage) {
//alert(maxFilesize);
//this.removeAllFiles();
if (errorMessage.indexOf('Error 404') !== -1) {
var errorDisplay = document.querySelectorAll('[data-dz-errormessage]');
errorDisplay[errorDisplay.length - 1].innerHTML = 'Error 404: The upload page was not found on the server';
}
if (errorMessage.indexOf('File is too big') !== -1) {
alert('i remove current file');
// i remove current file
drop.removeFile(file);
}
});
}
});
Run Code Online (Sandbox Code Playgroud)