|
@@ -21,10 +21,10 @@ async function init() {
|
|
|
}
|
|
|
|
|
|
//初始化上传入口
|
|
|
-async function initMultipartUpload(file, folderid) {
|
|
|
+async function initMultipartUpload(key) {
|
|
|
const params = {
|
|
|
Bucket: bucketname,
|
|
|
- Key: folderid + "/" + file.name
|
|
|
+ Key: key
|
|
|
};
|
|
|
//创建一个续传通道
|
|
|
const data = await bucket.createMultipartUpload(params).promise();
|
|
@@ -82,7 +82,7 @@ async function uploadFile(file, folderid) {
|
|
|
try {
|
|
|
init(); // 初始化aws接口
|
|
|
// 初始化分块上传
|
|
|
- uploadid = await initMultipartUpload(file, folderid);
|
|
|
+ uploadid = await initMultipartUpload(keyname);
|
|
|
// 分块上传文件
|
|
|
let parts = [];
|
|
|
let start = 0;
|
|
@@ -209,7 +209,7 @@ async function awsupload(file, folderid, filestate) {
|
|
|
}
|
|
|
//不存在,上传新的
|
|
|
else {
|
|
|
- const uploadid = await initMultiPartUpload(bucket, params); //初始化文件上传
|
|
|
+ const uploadid = await initMultipartUpload(key); //初始化文件上传
|
|
|
return await awsuploadpart(filestate, file, uploadid, [], key);
|
|
|
}
|
|
|
}
|
|
@@ -225,5 +225,4 @@ async function awsupload(file, folderid, filestate) {
|
|
|
filestate.status = "error";
|
|
|
console.log(err);
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
+}
|