Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
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
Administrator
dsk-cr20g
Commits
c67c6473
Commit
c67c6473
authored
Nov 28, 2023
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传乱码处理
parent
b22ef515
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
FileUploadUtils.java
.../main/java/com/dsk/common/utils/file/FileUploadUtils.java
+2
-1
BusinessFileController.java
...n/java/com/dsk/biz/controller/BusinessFileController.java
+1
-1
No files found.
dsk-common/src/main/java/com/dsk/common/utils/file/FileUploadUtils.java
View file @
c67c6473
...
@@ -116,7 +116,8 @@ public class FileUploadUtils
...
@@ -116,7 +116,8 @@ public class FileUploadUtils
// String fileName = extractFilename(file);
// String fileName = extractFilename(file);
// String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
// String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
String
absPath
=
getAbsoluteFile
(
baseDir
,
file
.
getOriginalFilename
()).
getAbsolutePath
();
String
fileName
=
new
String
(
file
.
getOriginalFilename
().
getBytes
(
"ISO-8859-1"
),
"UTF-8"
);
String
absPath
=
getAbsoluteFile
(
baseDir
,
fileName
).
getAbsolutePath
();
file
.
transferTo
(
Paths
.
get
(
absPath
));
file
.
transferTo
(
Paths
.
get
(
absPath
));
// return getPathFileName(baseDir, fileName);
// return getPathFileName(baseDir, fileName);
return
baseDir
+
file
.
getOriginalFilename
();
return
baseDir
+
file
.
getOriginalFilename
();
...
...
dsk-module/dsk-biz-api/src/main/java/com/dsk/biz/controller/BusinessFileController.java
View file @
c67c6473
...
@@ -78,7 +78,7 @@ public class BusinessFileController extends BaseController {
...
@@ -78,7 +78,7 @@ public class BusinessFileController extends BaseController {
public
AjaxResult
uploadFolder
(
@RequestPart
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
)
{
public
AjaxResult
uploadFolder
(
@RequestPart
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
)
{
try
{
try
{
//获取文件名
//获取文件名
String
filename
=
file
.
getOriginalFilename
(
);
String
filename
=
new
String
(
file
.
getOriginalFilename
().
getBytes
(
"ISO-8859-1"
),
"UTF-8"
);
String
businessFileName
=
request
.
getHeader
(
"FilePath"
);
String
businessFileName
=
request
.
getHeader
(
"FilePath"
);
// 上传文件路径
// 上传文件路径
String
filePath
=
FileUploadUtils
.
getDefaultBaseDir
()
+
businessFileName
+
"/"
;
String
filePath
=
FileUploadUtils
.
getDefaultBaseDir
()
+
businessFileName
+
"/"
;
...
...
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