fix:文件上传大小限制

This commit is contained in:
momo 2023-08-21 13:42:11 +08:00
parent bd092f44c8
commit 23d68effd4

View File

@ -95,6 +95,12 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us
return resp.SetStatus(basic.CodeFileUploadErr, "file upload err,file is not image")
}
// 限制上传文件大小 50k
maxSize := 100 * 1024
if fileHeader.Size > int64(maxSize) {
return resp.SetStatus(basic.CodeFileUploadErr, "file upload err,The file size exceeds the maximum limit of 100k")
}
// 读取数据流
ioData, err := io.ReadAll(fileObject)
if err != nil {