Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hubin
long-tern-care-service
Commits
1e0bcb6b
Commit
1e0bcb6b
authored
Feb 10, 2023
by
“xuhd”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件类型判断
parent
66a5d5dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
FileUploadController.java
.../hungraim/ltc/system/controller/FileUploadController.java
+1
-1
bootstrap.yml
system/system-admin-service/src/main/resources/bootstrap.yml
+14
-4
No files found.
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/FileUploadController.java
View file @
1e0bcb6b
...
...
@@ -44,7 +44,7 @@ public class FileUploadController {
String
fileType
=
originalFilename
.
substring
(
file
.
getOriginalFilename
().
lastIndexOf
(
"."
));
List
<
String
>
fileTypes
=
fileUploadConfig
.
getType
();
log
.
info
(
"支持图片类型:"
+
fileTypes
+
",上传的图片类型:"
+
fileType
);
if
(!
fileTypes
.
contains
(
fileType
)){
if
(!
fileTypes
.
stream
().
anyMatch
(
e
->
e
.
equalsIgnoreCase
(
fileType
)
)){
log
.
info
(
"上传文件错误"
);
return
Result
.
failed
(
ResultCode
.
FILE_TYPE_ERROR
);
}
...
...
system/system-admin-service/src/main/resources/bootstrap.yml
View file @
1e0bcb6b
...
...
@@ -36,9 +36,19 @@ file:
upload
:
path
:
E:/workspace/upload
type
:
-
.
JPG
-
.
JPEG
-
.
png
-
.
gif
-
.jpg
-
.jpeg
-
.png
-
.PNG
-
.bmp
-
.zip
-
.rar
-
.7z
-
.gz
-
.doc
-
.docx
-
.xls
-
.xlsx
-
.pdf
-
.txt
-
.csv
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