How to limit the number of dropzone.js files uploaded?

前端 未结 13 1284
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 04:28

Depending on the use case, how do I constrain the number of files that dropzone.js will allow?

For example, I might need to only allow 1, 2, or 4 files uploaded.

相关标签:
13条回答
  • 2020-11-28 04:57

    Alternative solution that worked really well for me:

    init: function() {
        this.on("addedfile", function(event) {
            while (this.files.length > this.options.maxFiles) {
                this.removeFile(this.files[0]);
            }
        });
    }
    
    0 讨论(0)
提交回复
热议问题