我正在为 dropzone 使用以下配置我正在同时上传多个文件 在服务器上它一次上传所有文件,然后向客户端发送响应。 但问题是在客户端站点上它多次调用(没有上传文件)成功函数。
我希望成功函数应该执行一次
我的代码是
$("i#dzopen").dropzone({
paramName: "file",
maxFilesize: 10,
url: 'UploadImages',
previewsContainer: "#media-upload-previews",
uploadMultiple: true,
parallelUploads: 10,
maxFiles: 20,
acceptedFiles: "image/*,audio/*,video/*",
init: function() {
this.on("success", function(file, responseText) {
alert("again");
console.log("log "+responseText);
$.each(responseText, function(k, v) {
console.log("l path " + v.largePicPath);
console.log("s path " + v.smallPicPath);
console.log("height " + v.imgHeight + " wid " + v.imgWidth);
});
console.log(file);
alert('uploded ' + file.name);
});
}
});
我尝试了代码 here
多次上传工作正常,但多次执行成功函数如何一次获得所有图像响应。
最佳答案
您应该使用 successmultiple
来检测所有成功上传,而不是 success
。
`this.on("successmultiple", function(file, responseText) {
关于javascript - 并行上传 :10 calling multiple times success function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27520547/