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