Uploadify 3.1将英文提示改成中文提示

今天测试报了个bug.使用Uploadify上传时。如果把空文件放到上传队列的时候,出现了以下提示框

 

 

觉得这提示框实在太专业了。需要修改下提示语。网上翻了几个地方,都没有找到解决办法。只有查看源码了,发现jquery.uploadify-3.1.js有这么一句

 

 

onSelectError : function(file, errorCode, errorMsg) {

// Load the swfupload settings

var settings = this.settings;

 

// Run the default event handler

if ($.inArray('onSelectError', settings.overrideEvents) < 0) {

switch(errorCode) {

case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:

if (settings.queueSizeLimit > errorMsg) {

this.queueData.errorMsg += '\nThe number of files selected exceeds the remaining upload limit (' + errorMsg + ').';

} else {

this.queueData.errorMsg += '\nThe number of files selected exceeds the queue size limit (' + settings.queueSizeLimit + ').';

}

break;

case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:

this.queueData.errorMsg += '\nThe file "' + file.name + '" exceeds the size limit (' + settings.fileSizeLimit + ').';

break;

case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:

this.queueData.errorMsg += '\nThe file "' + file.name + '" is empty.';

break;

case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:

this.queueData.errorMsg += '\nThe file "' + file.name + '" is not an accepted file type (' + settings.fileTypeDesc + ').';

break;

}

}

if (errorCode != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {

delete this.queueData.files[file.id];

}

 

// Call the user-defined event handler

if (settings.onSelectError) settings.onSelectError.apply(this, arguments);

}

 

没错了,就是在onSelectError 事件里面,提示语的内容依赖于queueData.errorMsg。于是在定义uoloadify的时候重写了该方法。

 

 

            'onSelectError' : function (file, errorCode, errorMsg) {

            //返回码。文件为空

            if(errorCode == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){

            this.queueData.errorMsg = "不能传空文件!!"

            }

            }

 

这样就可以在选择空文件后,返回自定义的提示语。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值