我正在使用Dropzone.js,并希望在触发某个事件时停止向队列中添加文件(准确地说,是precise到达的)。
假设我在我的“浏览”窗口中选择了15个文件,但我的maxFiles限制是10。在第11次,将触发一个maxFiles到达事件。此时,我希望不将剩余的5个文件添加到队列中。
以下是我现在所拥有的:
init : function() {
this.on('maxfilesreached', function(e){
alert("I want to stop adding stuff to the queue here");
});
如果已经选择了太多的文件,我希望取消队列中的所有将来添加的内容。我该怎么做?
提前感谢
一个。
发布于 2015-03-20 05:28:00
我应该知道的。RTFM以我和我的家人为耻。
在常见问题中,这是正确的方法:
this.on('maxfilesexceeded',function(file) {
this.removeFile(file);
alert("Oh wait you've exceeded your quota.");
});
我现在要去戴一个羞耻的圆锥体。
发布于 2015-03-20 03:23:57
尝尝这个,
var myDropzone = new Dropzone("#dropzone", {
acceptedFiles: ".jpeg,.jpg,.png,.gif,.TIF,.JPEG,.JPG,.PNG,.GIF",
addRemoveLinks: true,
parallelUploads: 2,
thumbnailWidth: "80",
thumbnailHeight: "80",
dictCancelUpload: "Cancel",
autoProcessQueue: false
});
其中#dropzone
是您的下拉区域id,无论它是表单id还是div id。parallelUploads: 5,
是将最大文件设置为uplaod。
https://stackoverflow.com/questions/29165026
复制相似问题