|
@@ -11603,11 +11603,23 @@ U.MD.D.I.downloadFile = function (cid, s, task, t, uid, type, text, loading, spa
|
|
}
|
|
}
|
|
let file = fileObj.dataURL;
|
|
let file = fileObj.dataURL;
|
|
if (file) {
|
|
if (file) {
|
|
- let ext = (file.name && file.name.split('.').pop()) || 'png';
|
|
|
|
- let basename = (file.name && file.name.split('.')[0]) || ('file_' + key);
|
|
|
|
|
|
+ // fileObj 结构类似:
|
|
|
|
+ // {
|
|
|
|
+ // name: "file_3344aa4c0fa552dc01cb2fe5edb6e4eb3aed9e39",
|
|
|
|
+ // size: 12034,
|
|
|
|
+ // type: "image/jpeg",
|
|
|
|
+ // webkitRelativePath: "",
|
|
|
|
+ // dataURL: File对象
|
|
|
|
+ // }
|
|
|
|
+ let ext = (fileObj.name && fileObj.name.lastIndexOf('.') !== -1)
|
|
|
|
+ ? fileObj.name.substring(fileObj.name.lastIndexOf('.') + 1)
|
|
|
|
+ : (file.type ? file.type.split('/')[1] : 'png');
|
|
|
|
+ let basename = (fileObj.name && fileObj.name.lastIndexOf('.') !== -1)
|
|
|
|
+ ? fileObj.name.substring(0, fileObj.name.lastIndexOf('.'))
|
|
|
|
+ : (fileObj.name || ('file_' + key));
|
|
var params = {
|
|
var params = {
|
|
Key: basename + '_' + new Date().getTime() + "." + ext,
|
|
Key: basename + '_' + new Date().getTime() + "." + ext,
|
|
- ContentType: file.type,
|
|
|
|
|
|
+ ContentType: fileObj.type || file.type || 'application/octet-stream',
|
|
Body: file,
|
|
Body: file,
|
|
"Access-Control-Allow-Credentials": "*",
|
|
"Access-Control-Allow-Credentials": "*",
|
|
ACL: "public-read",
|
|
ACL: "public-read",
|