Plupload - Restrict to only one file

后端 未结 13 1016
攒了一身酷
攒了一身酷 2021-02-02 10:15

I don\'t see an option in the plupload API docs on restricting the number of files uploaded, to any number, even 1.

Doc fail? or Feature fail? If it doesn\'t exist I\'ll

13条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 11:12

        FilesAdded: function(up, files) {
            up.files.splice(0,up.files.length-1);
        },
        multi_selection: false,
    

    use up.files, just files. files will always contain single item what we select from file browser. up.files is the actual list which we need to shrink to last selected file.

提交回复
热议问题