You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
729 B
24 lines
729 B
package web
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"goskeleton/app/global/consts"
|
|
"goskeleton/app/global/variable"
|
|
"goskeleton/app/service/upload_file"
|
|
"goskeleton/app/utils/response"
|
|
)
|
|
|
|
type Upload struct {
|
|
}
|
|
|
|
// 文件上传是一个独立模块,给任何业务返回文件上传后的存储路径即可。
|
|
// 开始上传
|
|
func (u *Upload) StartUpload(context *gin.Context) {
|
|
savePath := variable.BasePath + variable.ConfigYml.GetString("FileUploadSetting.UploadFileSavePath")
|
|
if r, finnalSavePath := upload_file.Upload(context, savePath); r == true {
|
|
response.Success(context, consts.CurdStatusOkMsg, finnalSavePath)
|
|
} else {
|
|
response.Fail(context, consts.FilesUploadFailCode, consts.FilesUploadFailMsg, "")
|
|
}
|
|
}
|