Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 取消单个文件的上载停止所有文件的上载-Dropzonejs_Javascript_Jquery_Asp.net Mvc_File Upload_Dropzone.js - Fatal编程技术网

Javascript 取消单个文件的上载停止所有文件的上载-Dropzonejs

Javascript 取消单个文件的上载停止所有文件的上载-Dropzonejs,javascript,jquery,asp.net-mvc,file-upload,dropzone.js,Javascript,Jquery,Asp.net Mvc,File Upload,Dropzone.js,当我开始使用以下代码上载多个文件时,addRemoveLinks:true提供取消上载的选项。当我取消上传的任何一个文件时,它会停止上传所有文件。它还显示总进度百分比为100% 谁能帮我理解我做错了什么?我想在取消上传一个单一的文件不应该影响其他文件的上传。 我该怎么做 Dropzone.options.myAwesomeDropzone = { autoProcessQueue: false, uploadMultiple: true, parallelUpload

当我开始使用以下代码上载多个文件时,addRemoveLinks:true提供取消上载的选项。当我取消上传的任何一个文件时,它会停止上传所有文件。它还显示总进度百分比为100%

谁能帮我理解我做错了什么?我想在取消上传一个单一的文件不应该影响其他文件的上传。 我该怎么做

Dropzone.options.myAwesomeDropzone = { 

    autoProcessQueue: false,
    uploadMultiple: true,
    parallelUploads: 100,
    maxFiles: 100,
    maxFilesize: 1000,
    addRemoveLinks: true,
    // The setting up of the dropzone
    init: function () {
        var myDropzone = this;
        this.element.querySelector("button[type=submit]").addEventListener("click", function (e) {
            // Make sure that the form isn't actually being sent.
            e.preventDefault();
            e.stopPropagation();
            var atLeastOneIsChecked = $('input:checkbox').is(':checked');
            if(atLeastOneIsChecked)
                myDropzone.processQueue();
            else
                alert("Please select a company!");
        });

        myDropzone.on("totaluploadprogress", function (progress) {
            // Update progress bar with the value in the variable "progress", which 
            // is the % total upload progress from 0 to 100
            $("#prog").html(progress);
        });

        myDropzone.on("drop", function (event) {
            // Update progress bar with the value in the variable "progress", which 
            // is the % total upload progress from 0 to 100
            $("#prog").html("0");
        });

    }

}

我通过修改源代码解决了这个问题

Dropzone.prototype.cancelUpload = function (file) {
    var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref;
    if (file.status === Dropzone.UPLOADING) {
        this.emit("canceled", file);
    } else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) {
        file.status = Dropzone.CANCELED;
        this.emit("canceled", file);
        if (this.options.uploadMultiple) {
            this.emit("canceledmultiple", [file]);
        }
    }
    if (this.options.autoProcessQueue) {
        return this.processQueue();
    }
};