我有一个悬浮窗的设置与下面的脚本:悬浮窗发送空
<script>
Dropzone.options.myDropzone = {
url: 'assets/PHP/createNieuws.php',
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 1,
maxFiles: 1,
maxFilesize: 1,
acceptedFiles: 'image/*',
addRemoveLinks: true,
createImageThumbnails: true,
init: function() {
dzClosure = this; // Makes sure that 'this' is understood inside the functions below.
this.on("success", function (file, responseText) {
console.log(responseText);
});
// for Dropzone to process the queue (instead of default form behavior):
document.getElementById("submit").addEventListener("click", function (e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
if (dzClosure.getQueuedFiles().length > 0) {
dzClosure.processQueue();
} else {
dzClosure.uploadFiles([{ name: 'nofiles' }]); //send empty
}
});
//send all the form data along with the files:
this.on("sendingmultiple", function (data, xhr, formData) {
formData.append("titel", jQuery("#titel").val());
formData.append("artikel", jQuery("#artikel").val());
});
}
}
</script>
,我也有一个名为为Default.png我的服务器上的文件。如果没有检测到图像,我希望dropzone引用default.png。正如你可以看到我已经tryed该解决方案已经没有更迭:https://stackoverflow.com/a/41044001/6396380
这将返回下面的错误在我的铬控制台:
dropzone.js:1497遗漏的类型错误:无法读取的未定义的属性“文件名”
我的dropzone版本是5.1.0。
任何想法如何解决这个问题?
它工作正常,在Chrome但Firefox给了一个错误:'类型错误:FormData.append的参数2未实现接口Blob.'我米使用版本5.1.1 – leoel
嗨:D你知道这个答案吗? https://stackoverflow.com/questions/45264550/how-to-upload-a-smaller-version-and-the-original-image-in-dropzone-js – TheProgrammer