我正在使用以下事件 http://www.dropzonejs.com/#event-successmultiple
尝试循环遍历 FileData 中的所有文件并向它们附加一些额外的属性。使用sendmultiple时FileData为空。它在使用常规发送事件时有效。
sendingmultiple: (files, xhr, formData) => {
for(let o of formData.entries()) {
console.log('testing 123', o);
//FormData is empty when using `sendingmultiple` event.
}
}
files 数组显示 25 个文件,而 formData 为空..
最佳答案
使用formData.append()
在你的函数内
我尚未使用 successMultiple
对此进行测试,以下是我的用例:
function init(dropzone) {
dropzone.on('sending', (event, xhr, formData) => {
formData.append('mimeType', event.type);
formData.append('filename', event.name);
});
}
const eventHandlers = {
init,
maxfilesexceeded: function(file) { // eslint-disable-line
this.removeAllFiles();
this.addFile(file);
},
};
关于javascript - Dropzone FormData 在 `sendingmultiple` 事件中不可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40030936/