Commit c67c6473 authored by lcl's avatar lcl

文件上传乱码处理

parent b22ef515
......@@ -116,7 +116,8 @@ public class FileUploadUtils
// String fileName = extractFilename(file);
// 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));
// return getPathFileName(baseDir, fileName);
return baseDir+file.getOriginalFilename();
......
......@@ -78,7 +78,7 @@ public class BusinessFileController extends BaseController {
public AjaxResult uploadFolder(@RequestPart("file") MultipartFile file, HttpServletRequest request) {
try {
//获取文件名
String filename = file.getOriginalFilename();
String filename = new String(file.getOriginalFilename().getBytes("ISO-8859-1"),"UTF-8");
String businessFileName = request.getHeader("FilePath");
// 上传文件路径
String filePath = FileUploadUtils.getDefaultBaseDir() + businessFileName + "/";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment