aliyun_oss,qiniu,tencent_cos: fix file open close

This commit is contained in:
黄笑
2021-06-17 14:51:35 +08:00
parent 9364f2a24a
commit 04d7aa9ab4
3 changed files with 3 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ func (*AliyunOSS) UploadFile(file *multipart.FileHeader) (string, string, error)
global.GVA_LOG.Error("function file.Open() Failed", zap.Any("err", openError.Error()))
return "", "", errors.New("function file.Open() Failed, err:" + openError.Error())
}
defer f.Close() // 创建文件 defer 关闭
// 上传阿里云路径 文件名格式 自己可以改 建议保证唯一性
yunFileTmpPath := filepath.Join("uploads", time.Now().Format("2006-01-02")) + "/" + file.Filename