限制文件上传大小

pull/789/head
Zheng Jie 2022-03-18 14:08:58 +08:00
parent 4eeabb843b
commit 7bf78d32ba
2 changed files with 2 additions and 2 deletions

View File

@ -253,7 +253,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M // 1M
int len = 1024 * 1024; int len = 1024 * 1024;
if (size > (maxSize * len)) { if (size > (maxSize * len)) {
throw new BadRequestException("文件超出规定大小"); throw new BadRequestException("文件超出规定大小" + maxSize + "M");
} }
} }

View File

@ -122,5 +122,5 @@ file:
path: C:\eladmin\file\ path: C:\eladmin\file\
avatar: C:\eladmin\avatar\ avatar: C:\eladmin\avatar\
# 文件大小 /M # 文件大小 /M
maxSize: 100 maxSize: 1
avatarMaxSize: 5 avatarMaxSize: 5