提交 bdde195e authored 作者: 若依's avatar 若依

!225 【bug修复】文件上传时出现java.nio.file.FileAlreadyExistsException

Merge pull request !225 from CANYON/master
...@@ -130,14 +130,10 @@ public class FileUploadUtils ...@@ -130,14 +130,10 @@ public class FileUploadUtils
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{ {
File desc = new File(uploadDir + File.separator + fileName); File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists()) {
if (!desc.getParentFile().exists()) if (!desc.getParentFile().exists()) {
{ desc.getParentFile().mkdirs();
desc.getParentFile().mkdirs(); }
}
if (!desc.exists())
{
desc.createNewFile();
} }
return desc; return desc;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论