Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
d959721f
Commit
d959721f
authored
Apr 15, 2025
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上传
parent
d14645b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
UnitInfoController.java
...s/boot/module/hygf/biz/controller/UnitInfoController.java
+14
-3
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/UnitInfoController.java
View file @
d959721f
...
...
@@ -222,11 +222,22 @@ public class UnitInfoController extends BaseController {
if
(
ValidationUtil
.
isEmpty
(
file
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
/// List<String> NOT_ALLOWED_TYPES =Arrays.asList("text/html
");
//
只支持图片类型
List
<
String
>
ALLOWED_TYPES
=
Arrays
.
asList
(
"jpg"
,
"jpeg"
,
"png
"
);
//只支持图片类型
if
(
file
.
getContentType
()
==
null
||
!
file
.
getContentType
().
startsWith
(
"image/"
))
{
throw
new
BadRequest
(
"只支持图片类型上传"
);
throw
new
BadRequest
(
"只支持
jpg,jpeg,png
图片类型上传"
);
}
//判断文件后缀
String
filename
=
file
.
getName
();
String
extension
=
filename
.
substring
(
filename
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
if
(!
ALLOWED_TYPES
.
contains
(
extension
))
{
throw
new
BadRequest
(
"只支持jpg,jpeg,png图片类型上传"
);
}
//判断文件大小10M
if
(
file
.
getSize
()
>
10
*
1024
*
1024
)
{
throw
new
BadRequest
(
"上传文件大小不超过10M"
);
}
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
...
...
Write
Preview
Markdown
is supported
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