mirror of https://github.com/elunez/eladmin
修复文件上传找不到系统路径问题 (#170)
`getCanonicalFile 可解析正确各种路径` 如果使用相对路径, 文件上传会报错, 使用 getCanonicalFile 修复pull/172/head
parent
fd9fb2a600
commit
58575378db
|
@ -140,7 +140,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||
try {
|
||||
String fileName = name + nowStr + "." + suffix;
|
||||
String path = filePath + fileName;
|
||||
File dest = new File(path);
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
dest.getParentFile().mkdirs();
|
||||
|
|
Loading…
Reference in New Issue