简体   繁体   English

setMaxFiles上传到dropzone.js

[英]setMaxFiles to upload in dropzone.js

I want to set the maximum number of files reached in dropzone.js by setting the 'maxfilesreached' property as follows: 我想通过如下设置'maxfilesreached'属性来设置dropzone.js中达到的最大文件数:

 maxfilesreached: function () {
      alert("Max Files reached")
  }

It is not firing on reaching maximum files. 达到最大文件数时未触发。

How to trigger this event? 如何触发此事件?

NOTE: I am using this dropzone.js in ASP.NET MVC 注意:我在ASP.NET MVC中使用此dropzone.js

Here is the Simple Code to Set Maximum Numbers of File 这是设置文件最大数量的简单代码

<form class="File" id="my-file"></form>

and JS: 和JS:

File.options.my-file = {
maxFiles: 1,
accept: function(file, done) {
console.log("uploaded");
done();
 },
init: function() {
this.on("maxfilesexceeded", function(file){
    alert("No more files please!");
});
 }
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM