Dropzone.options.imageFile = {
url: HOST_NAME + USER_NAME + BUILDER_API +'image/',
method: 'POST',
// enter code here
acceptedFiles: '.jpg, .jpeg, .png',
paramName: "imagefile", // The name that will be used to transfer the file
maxFilesize: 10, // MB
//addRemoveLinks: true,
maxFiles: 2,
init: function() {
this.on("success", function(file, response) {
image_id = response.id;
IMAGES.push(image_id);
check_files();
}),
this.on("removedfile", function(file, response){
data = JSON.parse(file.xhr.response);
alert(data['id']);
});
},
};
我必须怎么做才能完全重置Dropzone?
最佳答案
并非100%肯定我理解了这个问题,但是我想您希望能够从其原始状态重用dropzone实例。
从技术上讲,您想调用removeAllFiles()
,这将删除所有文件。
这是一个示例,向您展示如何使用一个按钮添加删除所有文件:Remove all files with one button
另外,还有其他人试图做与您正在寻找的相同的事情:Reset dropzone to Pristine state
关于reset - 如何在此代码中重置dropzone?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21702526/