Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
caafb830
Commit
caafb830
authored
May 25, 2022
by
Zheng Jie
Browse files
演示环境文件大小限制
parent
71279e3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
View file @
caafb830
...
@@ -252,9 +252,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
...
@@ -252,9 +252,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
public
static
void
checkSize
(
long
maxSize
,
long
size
)
{
public
static
void
checkSize
(
long
maxSize
,
long
size
)
{
// 1M
// 1M
int
len
=
1024
*
1024
;
int
len
=
1024
*
1024
;
maxSize
=
(
long
)(
maxSize
*
len
*
0.05
);
if
(
size
>
(
maxSize
*
len
*
0.05
))
{
if
(
size
>
maxSize
)
{
throw
new
BadRequestException
(
"文件超出规定大小: "
+
50
+
"KB"
);
throw
new
BadRequestException
(
"文件超出规定大小:"
+
50
+
"KB"
);
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment