Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
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
liqin
chnmuseum-party
Commits
880587ce
Commit
880587ce
authored
Jun 04, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上传互动内容上传图片处能够上传视频
parent
5dba414f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
FileUploadController.java
.../chnmuseum/party/web/controller/FileUploadController.java
+12
-1
No files found.
src/main/java/cn/chnmuseum/party/web/controller/FileUploadController.java
View file @
880587ce
...
...
@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
...
...
@@ -94,7 +95,7 @@ public class FileUploadController extends BaseController {
})
@PostMapping
(
value
=
"/datum/upload"
,
headers
=
"content-type=multipart/form-data"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@ApiOperation
(
value
=
"展板资料上传"
,
notes
=
"展板资料上传"
)
public
Map
<
String
,
Object
>
uploadDatum
(
@RequestPart
(
value
=
"file"
,
required
=
false
)
MultipartFile
[]
files
)
throws
IOException
{
public
Map
<
String
,
Object
>
uploadDatum
(
@RequestPart
(
value
=
"file"
,
required
=
false
)
MultipartFile
[]
files
,
HttpServletRequest
request
)
throws
IOException
{
if
(
files
==
null
||
files
.
length
==
0
)
{
return
getFailResult
(
"没有文件可供上传"
);
}
...
...
@@ -127,6 +128,16 @@ public class FileUploadController extends BaseController {
continue
;
}
String
image
=
request
.
getParameter
(
"image"
);
if
(
image
!=
null
&&
image
.
equals
(
"1"
))
{
String
extension
=
FilenameUtils
.
getExtension
(
originalFilename
);
boolean
anyMatch1
=
Arrays
.
stream
(
IMAGE_TYPE
).
anyMatch
(
s
->
Objects
.
equals
(
s
,
extension
.
toUpperCase
()));
if
(!
anyMatch1
)
{
return
getFailResult
(
"文件格式不支持"
);
}
}
String
baseName
=
FilenameUtils
.
getBaseName
(
originalFilename
);
String
extName
=
FilenameUtils
.
getExtension
(
originalFilename
);
String
finalExtName
=
extName
;
...
...
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