fix:文件上传大小限制
This commit is contained in:
parent
bd092f44c8
commit
23d68effd4
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user