作者 若依

!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
130 private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException 130 private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
131 { 131 {
132 File desc = new File(uploadDir + File.separator + fileName); 132 File desc = new File(uploadDir + File.separator + fileName);
133 -  
134 - if (!desc.getParentFile().exists())  
135 - { 133 + if (!desc.exists()) {
  134 + if (!desc.getParentFile().exists()) {
136 desc.getParentFile().mkdirs(); 135 desc.getParentFile().mkdirs();
137 } 136 }
138 - if (!desc.exists())  
139 - {  
140 - desc.createNewFile();  
141 } 137 }
142 return desc; 138 return desc;
143 } 139 }