【问题标题】:parallelUploads:10 calling multiple times success functionparallelUploads:10 多次调用成功函数
【发布时间】:2014-12-17 07:46:20
【问题描述】:

我正在为 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

多次上传正常,但多次执行成功函数如何一次获取所有图像响应。

【问题讨论】:

    标签: javascript jquery dropzone.js


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2020-03-03
      • 1970-01-01
      • 2019-01-12
      • 2016-10-07
      • 2012-07-27
      • 2010-11-16
      • 2018-02-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多