- 阿里云增加上传本地文件
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

master v1.0.7
李光春 2 years ago
parent 5c0da54d15
commit fa93945a4c

@ -173,3 +173,22 @@ func (c *AliYun) PutObject(file io.Reader, filePath, fileName string) (resp File
resp.Url = objectKey
return
}
// PutLocalFile 上传本地文件
// @param localFile 本地文件路径
// @param filePath 文件路径
// @param fileName 文件名称
func (c *AliYun) PutLocalFile(localFilePath, filePath, fileName string) (resp FileInfo, err error) {
if localFilePath == "" {
return FileInfo{}, errors.New("localFilePath 不能为空")
}
objectKey := filePath
if fileName != "" {
objectKey = filePath + "/" + fileName
}
err = c.bucket.PutObjectFromFile(objectKey, localFilePath)
resp.Path = filePath
resp.Name = fileName
resp.Url = objectKey
return
}

@ -1,3 +1,3 @@
package gostorage
const Version = "1.0.6"
const Version = "1.0.7"

Loading…
Cancel
Save