我正在尝试向dropzone.js添加进度条。当我添加文件时,出现了进度条,但是当我按下保存按钮时,没有任何反应。保存按钮是用于保存文件的自定义按钮,已添加到dropezone。我就是这样做的
$(document).on("click", "#AddLogoForm .btn-save", function (e) {
e.preventDefault();
e.stopPropagation();
if (logoDropzone.files.length > 0)
{
logoDropzone.processQueue();
}
else
{
$("#AddLogoForm").submit();
}
logoDropzone.on("success", function() {
location.reload(true);
});
});
这是我添加进度条的HTML代码
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
</div>
我做错了什么?
编辑:这就是我所说的dropzone:
function DropzoneInit() {
var previewNode = $("#template");
previewNode[0].id = "";
var previewTemplate = previewNode.parent().html();
previewNode.remove();
var logoDropzone = new Dropzone("#AddLogoForm", {
url: $("#AddLogoForm").attr("action"),
thumbnailWidth: 80,
thumbnailHeight: 80,
maxFiles: 1,
autoProcessQueue: false,
previewTemplate: previewTemplate,
previewsContainer: "#logopreviews",
clickable: "#AddLogoForm .dz-input",
accept: function (file, done) {
if (file.type != "image/jpeg" && file.type != "image/png" && file.type != "image/gif") {
done("Error! Files of this type are not accepted");
}
else { done(); }
}
});