...
|
...
|
@@ -78,3 +78,27 @@ func saveFile(fileData *multipart.FileHeader, fileType string) (hostpath string, |
|
|
hostpath = config.MConfig.FileHost + filepath.Join(config.MConfig.FileHostPath, fileType, mfileName)
|
|
|
return hostpath, nil
|
|
|
}
|
|
|
|
|
|
//UploadVideo 视频上传
|
|
|
//@router /video
|
|
|
func (c *UploadController) UploadVideo() {
|
|
|
var msg *protocol.ResponseMessage
|
|
|
defer func() {
|
|
|
c.ResposeJson(msg)
|
|
|
}()
|
|
|
filehead, err := c.GetFiles("file")
|
|
|
if err != nil {
|
|
|
log.Error("获取上传文件失败:%s", err)
|
|
|
}
|
|
|
var rsp ResponseUploadImage
|
|
|
for i := range filehead {
|
|
|
hostpath, err := saveFile(filehead[i], "video")
|
|
|
if err != nil {
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
return
|
|
|
}
|
|
|
rsp.Urls = append(rsp.Urls, hostpath)
|
|
|
}
|
|
|
msg = protocol.NewReturnResponse(rsp, nil)
|
|
|
return
|
|
|
} |
...
|
...
|
|