大家好,我正在用dropzone.js上传图片到服务器上,但是我有点问题。
我想知道是否有任何方法可以在拖放图像或单击并选择图像并使用可单击的提交按钮手动将图像提交到服务器时禁用dropzone.js自动上传到服务器
请任何建议或帮助,也许一个简单的代码将不胜感激。
编辑的
我仍然没有得到我的问题的答案。
认真地说,我觉得这个东西做的不对,因为这个东西在某些方面是没用的,他们是不是想告诉我,当一个用户上传了它的头像,dropzone就会卡在那里看着他们,他们看着它却没有提交按钮或确认消息,图片已经上传了,那么他们应该继续吗?我是认真的?
发布于 2015-12-11 00:32:12
您可以在HTML表单中定义按钮,例如
<button id="submit-all">Submit all files</button>
然后添加这个脚本
Dropzone.options.myDropzone = {
// Prevents Dropzone from uploading dropped files immediately
autoProcessQueue: false,
acceptedFiles: ".png,.jpg,.gif,.bmp,.jpeg",
maxFilesize: 1,
parallelUploads: 10,
addRemoveLinks: true,
init: function() {
var submitButton = document.querySelector("#submit-all")
myDropzone = this; // closure
submitButton.addEventListener("click", function() {
myDropzone.processQueue();
// autoProcessQueue: true// Tell Dropzone to process all queued files.
});
// You might want to show the submit button only when
// files are dropped here:
this.on("addedfile", function() {
// Show submit button here and/or inform user to click it.
});
}
};
希望这能解决problem.refrence https://github.com/enyo/dropzone/wiki/Upload-all-files-with-a-button的问题
https://stackoverflow.com/questions/33047408
复制相似问题