问题描述
使用 Plupload v2.1.2
一张图片说明了一切。从本质上讲,如果添加损坏的 JPEG 文件,或者添加一个无效(不被接受)的 MIME 类型的文件,该文件只是简单地重命名为“有效”扩展名,那么我会收到一个未捕获的“WRONG_FORMAT”错误。我怎么能捕捉到它并让 Plupload 显示有效的错误消息,就像它对 max_file_size 过滤器所做的那样,或者无效的文件扩展名?
到目前为止我的代码:
// Initialize the widget when the DOM is ready
$(function() {
$("#uploader").plupload({
// General settings
runtimes : 'html5,html4',url : "index.cfm?fa=MediaMod.CreateMediaFile",chunk_size: '1mb',filters : {
// Maximum file sizes
max_file_size : '1mb',// Specify what files to browse for
mime_types: [
{title : "Image files",extensions : "jpg,jpeg,gif,png"}
]
},// Rename files by clicking on their titles
rename: true,// Sort files
sortable: true,// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
dragdrop: true,// Views to activate
views: {
list: true,thumbs: true,// Show thumbs
active: 'thumbs'
},init : {
// Fires when a error occurs.
Error: function(uploader,error) {
if (error.status == 400) {
console.warn("File Failed: " + error.file.name);
}
else {
// re-throw...?
}
}
}
});
$("#uploader").on("complete",function() {
window.parent.closePopWin();
});
});
感谢您的帮助。 拍
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)