|
|
|
@ -445,8 +445,9 @@
|
|
|
|
|
url: "", |
|
|
|
|
multiple: true, |
|
|
|
|
accept: "", // .png,.pdf,image/jpg,image/* 等
|
|
|
|
|
maxSize: -1, // 1024 * 1024
|
|
|
|
|
maxLength: -1 // 无限制, 与multiple配合使用
|
|
|
|
|
maxSize: -1, // 1024 * 1024 单位b
|
|
|
|
|
maxLength: -1, // 无限制, 与multiple配合使用
|
|
|
|
|
errorText: BI.emptyFn, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -472,12 +473,10 @@
|
|
|
|
|
// handlers
|
|
|
|
|
|
|
|
|
|
_wrap.onloadstart = function (rpe, xhr) { |
|
|
|
|
// BI.Msg.toast("loadstart");
|
|
|
|
|
self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
_wrap.onprogress = function (rpe, xhr) { |
|
|
|
|
// BI.Msg.toast("onprogress");
|
|
|
|
|
// percent for each bar
|
|
|
|
|
|
|
|
|
|
// fileSize is -1 only if browser does not support file info access
|
|
|
|
@ -561,21 +560,26 @@
|
|
|
|
|
var validateFileType = fileTypeValidate(value, wrap.fileType); |
|
|
|
|
if (!validateFileType) { |
|
|
|
|
// 文件类型不支持
|
|
|
|
|
BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" }); |
|
|
|
|
BI.Msg.toast(o.errorText({ |
|
|
|
|
errorType: 0, |
|
|
|
|
file: item |
|
|
|
|
}) || BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" }); |
|
|
|
|
self.fireEvent(BI.File.EVENT_ERROR, { |
|
|
|
|
errorType: 0, |
|
|
|
|
file: item |
|
|
|
|
}); |
|
|
|
|
} else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { |
|
|
|
|
// 文件大小不支持
|
|
|
|
|
BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error", wrap.maxSize), { level: "error" }); |
|
|
|
|
BI.Msg.toast(o.errorText({ |
|
|
|
|
errorType: 1, |
|
|
|
|
file: item |
|
|
|
|
}) || BI.i18nText("BI-Upload_File_Size_Error", Math.ceil(wrap.maxSize / 1024 / 1024)), { level: "error" }); |
|
|
|
|
self.fireEvent(BI.File.EVENT_ERROR, { |
|
|
|
|
errorType: 1, |
|
|
|
|
file: item |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
wrap.files.unshift(item); |
|
|
|
|
// BI.Msg.toast(value);
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|