解决WebUploader上传文件成功后再次选择文件的问题

首先需要了解WebUploader的几个API

具体可以到官网上查询
https://fex.baidu.com/webuploader/doc/index.html

removeFile

  • removeFile( file ) ⇒ undefined
  • removeFile( id ) ⇒ undefined
  • removeFile( file, true ) ⇒ undefined
  • removeFile( id, true ) ⇒ undefined
    参数:
  • file {File, id}
    File对象或这File对象的id

移除某一文件, 默认只会标记文件状态为已取消,如果第二个参数为 true 则会从 queue 中移除。

reset

  • reset() ⇒ undefined

重置uploader。目前只重置了队列。就可以清除勾选的上传文件了

uploadSuccess

uploadSuccess 一个文件上传成功的回调事件

uploadFinished

所有文件上传成功后调用

//成功事件
uploader.on('uploadSuccess', function (file, response) {
  uploader.removeFile(file);//移除文件
});
// 所有文件上传成功
uploader.on('uploadFinished', function () {
    //清空队列
     uploader.reset();
});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值