Dropzone.js event after drop end and before uploading
Dropzone.js event after drop end and before uploading
我正在寻找一个dropzone.js
事件,该事件在放置结束后和上传之前引发。
我需要的是一次访问有关丢弃文件的所有信息,而不是逐个文件访问,因此addedfile
事件不是一个选项。
我认为dragend
事件是合适的,但当我将文件放入dropzone时,它并没有被触发。
我使用的代码片段如下所示:
Dropzone.options.myDropzone = {
// Prevents Dropzone from uploading dropped files immediately
autoProcessQueue : false,
dictDefaultMessage: "Drop files or click here to upload a new DICOM series ...",
init : function() {
myDropzone = this;
//Restore initial message when queue has been completed
this.on("dragend", function(file) {
console.log("ondragend");
});
}
};
我是不是错过了什么?dropzone.js
中是否存在其他用于此目的的事件?
有一个名为addedfiles
的事件,它将在两个"拖放";以及手动文件选择。
this.on("addedfiles", function(files) {
console.log(files.length + ' files added');
});
如果您想对drop事件进行回调,则应该使用"drop"。在该事件中,请查看"files"数组。但请注意,如果用户单击dropzone并从中选择文件,则不会触发此事件。
Dropzone.options.MyDropzone = {
autoProcessQueue : false,
dictDefaultMessage: "Drop files or click here to upload a new DICOM series ...",
init : function() {
myDropzone = this;
//Restore initial message when queue has been completed
this.on("drop", function(event) {
console.log(myDropzone.files);
});
}
};
例如,请参阅此fiddle:jsfiddle.net/qqkbzv5a/2/
最后我使用了selectedfiles
事件,它响应dropzone的drop和click操作。
this.on("selectedfiles", function(listFiles) {
cont_files = listFiles.length;
});
相关文章:
- Selenium WebDriver and JavaScript change
- 无法覆盖CSS伪元素:before
- PHP and Javascript functions
- React DOM offsetHeight before rendering
- Javascript Return and if/else
- SetTimeout and clearTimeout in Javascript
- lightbox in html 5 and javascript
- TimelineJS and AngularJS
- timeago.js with datatable and PHP
- javascript button ajax and php
- Ajax and Json with Rails
- Combine onload, onresize and onclick
- php布尔值's小写AND大写和数字布尔值'可以接受
- setTimeout and V8
- SyntaxError:缺少;before语句使用AJAX
- Jquery post and onclick
- Moment js and IOS
- Jquery:prepend()VS before()and append()VS after(),what'他
- Dropzone.js event after drop end and before uploading
- jQuery and CSS :before