Commit a387e46a authored by chenhan wang's avatar chenhan wang
Browse files

feat:文件上传功能

parent e730125d
......@@ -86,14 +86,7 @@ func FileUp(c echo.Context) error {
return err
}
info.Name = file.Filename
// 打开用户上传的文件
src, err := file.Open()
if err != nil {
logrus.Println(err)
return err
}
defer src.Close()
info.Content, err = FileRead(file)
if overflow(info.Content, 8*1024*1024) {
return response.SendResponse(c, http.StatusForbidden, "error:文件上传失败: 文件大小超过8MB.", "")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment