【发布时间】:2017-07-12 13:02:01
【问题描述】:
当我开始使用以下代码上传多个文件时,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");
});
}
}
【问题讨论】:
标签: javascript jquery asp.net-mvc file-upload dropzone.js