gpt4 book ai didi

dropzone.js - 不以编程方式启动时如何运行Dropzone processQueue()?

转载 作者:行者123 更新时间:2023-12-04 00:00:41 26 4
gpt4 key购买 nike

我试图通过将类添加到这样的形式来初始化dropzone:

<form class="dropzone ng-pristine ng-valid dz-clickable" id="photoDropzoneDiv" action="/panel/vehicles/3/photos" accept-charset="UTF-8" method="post">


现在dropzone起作用了。接下来,我将dropzone设置为不自动处理队列:

Dropzone.options.photoDropzone = {
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 5, // MB
autoProcessQueue: false,
parallelUploads: 500,
acceptedFiles: '.jpg,.jpeg,.JPEG,.JPG,.png,.PNG',
addRemoveLinks: true,
init: function(file, done) {
this.on("queuecomplete", function(file) {
this.removeAllFiles();
});
}
};


现在,当我这样调用processQueue时:

photoDropzone.processQueue();


它说 Uncaught TypeError: photoDropzone.processQueue is not a function。我怎样才能解决这个问题?

最佳答案

Dropzone.options.addFiles = {
maxFileSize : 4,
parallelUploads : 10,
uploadMultiple: true,
autoProcessQueue : false,
addRemoveLinks : true,
init: function() {
var submitButton = document.querySelector("#act-on-upload")
myDropzone = this;
submitButton.addEventListener("click", function() {
myDropzone.processQueue();
});
myDropzone.on("addedfile", function(file) {
if (!file.type.match(/image.*/)) {
if(file.type.match(/application.zip/)){
myDropzone.emit("thumbnail", file, "path/to/img");
} else {
myDropzone.emit("thumbnail", file, "path/to/img");
}
}
});
myDropzone.on("complete", function(file) {
myDropzone.removeFile(file);
});
},
};

关于dropzone.js - 不以编程方式启动时如何运行Dropzone processQueue()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31354085/

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