dropzone upload only one file

前端 未结 6 1291
时光说笑
时光说笑 2021-02-01 02:11

I am using dropzone.js for my drag-drop file upload solution. I want to upload only one file,if i upload second file the first one should be remove and second one should be uplo

6条回答
  •  深忆病人
    2021-02-01 02:30

    The combination of two solutions does the job for me in the init function:

            this.on("addedfile", function (file) {
                if (this.files.length > 1) {
                    this.removeAllFiles()
                    this.addFile(file);
                }
            });
    

提交回复
热议问题