diff --git a/api/index.go b/api/index.go index 552d455..ad4fe33 100644 --- a/api/index.go +++ b/api/index.go @@ -28,9 +28,10 @@ func UploadFile(c *gin.Context) (result.Data, error) { return nil, errors.NewBusinessError("文件不存在") } - fmt.Println(filePath, destPath) + fmt.Println(filePath, destPath, isDeleteLocal) url, err := global.Storage.Upload(filePath, destPath) if err != nil { + fmt.Println(err.Error()) return nil, err } if isDeleteLocal == "1" { diff --git a/uploader b/uploader new file mode 100755 index 0000000..2650372 Binary files /dev/null and b/uploader differ diff --git a/utils/storage/cos_storage.go b/utils/storage/cos_storage.go index 24d216e..70441ff 100644 --- a/utils/storage/cos_storage.go +++ b/utils/storage/cos_storage.go @@ -38,7 +38,7 @@ func (s *CosStorage) Upload(filePath, destPath string) (string, error) { } _, _, err = client.Object.Upload( - context.Background(), destPath, filePath, nil, + context.Background(), destPath, filePath, &cos.MultiUploadOptions{ThreadPoolSize: 5, PartSize: 30}, ) if err != nil { return "", err