Plupload - Restrict to only one file

后端 未结 13 1018
攒了一身酷
攒了一身酷 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:11

    Based on Jonathon Bolster's second answer, I wrote this simpler snippet to restrict upload to the last selected file:

    uploader.bind('FilesAdded', function(up, files) {
        while (up.files.length > 1) {
            up.removeFile(up.files[0]);
        }
    });
    

提交回复
热议问题