取消上传单个文件会停止所有文件的上传 - Dropzonejs

时间:2017-02-22 12:58:26

标签: javascript jquery asp.net-mvc file-upload dropzone.js

  

当我使用以下代码开始上传多个文件时, 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");
        });

    }

}

1 个答案:

答案 0 :(得分:0)

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

{{1}}