parallelUploads:10次调用多次成功函数

时间:2014-12-17 07:46:20

标签: javascript jquery dropzone.js

我正在使用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

多次上传工作正常但多次执行成功功能如何一次性获取所有图像响应。

1 个答案:

答案 0 :(得分:2)

而不是success,您应该使用successmultiple来检测所有成功的上传。

`this.on("successmultiple", function(file, responseText) {

欲了解更多信息: http://www.dropzonejs.com/#event-successmultiple

相关问题