首页 新闻 会员 周边 捐助

uploadify 设置uploadLimit,上传总数限制,重写onUploadError时总是会弹出The upload limit has been reac

0
悬赏园豆:100 [已解决问题] 解决于 2016-07-05 16:32

uploadify 设置了uploadLimit:5,当上传的图片数量大于5的时候,因为我重写了onUploadError进行提示,总是会弹出一句:The upload limit has been reached (...).

查看了源码发现

switch (errorCode) {
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
errorString = 'HTTP Error (' + errorMsg + ')';
break;
case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
errorString = 'Missing Upload URL';
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
errorString = 'IO Error';
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
errorString = 'Security Error';
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
alert('The upload limit has been reached (' + errorMsg + ').');
errorString = 'Exceeds Upload Limit';
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
errorString = 'Failed';
break;
case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
errorString = 'Validation Error';
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
errorString = 'Cancelled';
this.queueData.queueSize -= file.size;
this.queueData.queueLength -= 1;
if (file.status == SWFUpload.FILE_STATUS.IN_PROGRESS || $.inArray(file.id, this.queueData.uploadQueue) >= 0) {
this.queueData.uploadSize -= file.size;
}
// Trigger the onCancel event
if (settings.onCancel) settings.onCancel.call(this, file);
delete this.queueData.files[file.id];
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
errorString = 'Stopped';
break;
}

这句是不是应该去掉啊 。

幌才的主页 幌才 | 初学一级 | 园豆:103
提问于:2016-07-04 23:36
< >
分享
最佳答案
0

当文件大于5的时候,触发了这个错误异常,肯定会执行alert()的,所以弹出你那句错误信息。不想弹出的话就去掉

收获园豆:100
弦断有谁听 | 初学一级 |园豆:20 | 2016-07-05 09:25

switch 的其他case都没有alert提示信息,唯独UPLOAD_LIMIT_EXCEEDED这个错误就有,这是源码,不想随便更改

幌才 | 园豆:103 (初学一级) | 2016-07-05 10:21

@戒不掉的是习惯: 不符合你要求的源码就可以改,源码不是一定不能改的,有的源码还有错呢。

弦断有谁听 | 园豆:20 (初学一级) | 2016-07-05 10:47
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册