Commit 285d181b authored by 廖旭伟's avatar 廖旭伟

上传接口修改

parent b8618e37
...@@ -49,7 +49,11 @@ public class UploadServiceImpl implements UploadService { ...@@ -49,7 +49,11 @@ public class UploadServiceImpl implements UploadService {
if (tempFile == null || tempFile.getSize() == 0) { if (tempFile == null || tempFile.getSize() == 0) {
throw new AppException("没有要上传的文件!"); throw new AppException("没有要上传的文件!");
} }
if(StringUtils.isEmpty(prePath)){
prePath = "file/uploadfile/";
}else {
prePath = prePath.endsWith("/")?prePath:prePath+"/";
}
String fileName = tempFile.getOriginalFilename(); String fileName = tempFile.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName); String extension = FilenameUtils.getExtension(fileName);
UploadFileType type = UploadFileType.getFileType(extension); UploadFileType type = UploadFileType.getFileType(extension);
...@@ -62,7 +66,8 @@ public class UploadServiceImpl implements UploadService { ...@@ -62,7 +66,8 @@ public class UploadServiceImpl implements UploadService {
} }
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/"; String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filePath = rootPath + (StringUtils.isEmpty(prePath) ? "file/uploadfile" : prePath + "/"); // String filePath = rootPath + (StringUtils.isEmpty(prePath) ? "file/uploadfile/" : prePath + "/");
String filePath = rootPath + prePath;
File pathDir = new File(filePath); File pathDir = new File(filePath);
if (!pathDir.exists()) { if (!pathDir.exists()) {
pathDir.mkdirs(); pathDir.mkdirs();
......
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