gpt4 book ai didi

javascript - dropzone js onclick提交文件上传

转载 作者:行者123 更新时间:2023-12-03 00:12:53 28 4
gpt4 key购买 nike

只需单击一个按钮即可上传所有文件。
HTML:

<button id="submit-all">Submit all files</button>
<form action="/target" class="dropzone" id="my-dropzone"></form>

JS:

Dropzone.options.myDropzone = {

// Prevents Dropzone from uploading dropped files immediately
autoProcessQueue: false,

init: function() {
var submitButton = document.querySelector("#submit-all")
myDropzone = this; // closure

submitButton.addEventListener("click", function() {
myDropzone.processQueue(); // 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.
});

}
};

但是文件是拖放后上传的..

最佳答案

使用简单的代码

Dropzone.autoDiscover = false;

var myDropzone = new Dropzone(element, {
url: "/upload.php",
autoProcessQueue: false,
});

$('#imgsubbutt').click(function(){
myDropzone.processQueue();
});

关于javascript - dropzone js onclick提交文件上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21232444/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com