package upload
|
|
import (
|
"mime/multipart"
|
)
|
|
// OSS 对象存储接口
|
// Author [SliverHorn](https://github.com/SliverHorn)
|
// Author [ccfish86](https://github.com/ccfish86)
|
type OSS interface {
|
UploadFile(file *multipart.FileHeader) (string, string, error)
|
DeleteFile(key string) error
|
}
|
|
type ossType string
|
|
const (
|
ossTypeLocal ossType = "local"
|
currentOssType = ossTypeLocal
|
)
|
|
// NewOss OSS的实例化方法
|
// Author [SliverHorn](https://github.com/SliverHorn)
|
// Author [ccfish86](https://github.com/ccfish86)
|
func NewOss() OSS {
|
switch currentOssType {
|
case ossTypeLocal:
|
return &Local{
|
StorePath: "/data/uploads/file",
|
Path: "/data/uploads/file",
|
}
|
default:
|
return &Local{}
|
}
|
}
|