Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
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
jenkins
slm-fileview
Commits
9a027674
Commit
9a027674
authored
Jul 30, 2019
by
陈精华
Committed by
kl
Jul 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
演示首页兼容IE
parent
e4407467
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
FileController.java
...rc/main/java/cn/keking/web/controller/FileController.java
+12
-0
No files found.
jodconverter-web/src/main/java/cn/keking/web/controller/FileController.java
View file @
9a027674
...
@@ -37,7 +37,19 @@ public class FileController {
...
@@ -37,7 +37,19 @@ public class FileController {
@RequestMapping
(
value
=
"fileUpload"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"fileUpload"
,
method
=
RequestMethod
.
POST
)
public
String
fileUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
public
String
fileUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
)
throws
JsonProcessingException
{
HttpServletRequest
request
)
throws
JsonProcessingException
{
// 获取文件名
String
fileName
=
file
.
getOriginalFilename
();
String
fileName
=
file
.
getOriginalFilename
();
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
// Check for Unix-style path
int
unixSep
=
fileName
.
lastIndexOf
(
'/'
);
// Check for Windows-style path
int
winSep
=
fileName
.
lastIndexOf
(
'\\'
);
// Cut off at latest possible point
int
pos
=
(
winSep
>
unixSep
?
winSep
:
unixSep
);
if
(
pos
!=
-
1
)
{
fileName
=
fileName
.
substring
(
pos
+
1
);
}
// 判断该文件类型是否有上传过,如果上传过则提示不允许再次上传
// 判断该文件类型是否有上传过,如果上传过则提示不允许再次上传
if
(
existsTypeFile
(
fileName
))
{
if
(
existsTypeFile
(
fileName
))
{
return
new
ObjectMapper
().
writeValueAsString
(
new
ReturnResponse
<
String
>(
1
,
"每一种类型只可以上传一个文件,请先删除原有文件再次上传"
,
null
));
return
new
ObjectMapper
().
writeValueAsString
(
new
ReturnResponse
<
String
>(
1
,
"每一种类型只可以上传一个文件,请先删除原有文件再次上传"
,
null
));
...
...
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