diff --git a/ova-boot/ova-seller/src/main/java/cn/ova/web/UploadRest.java b/ova-boot/ova-seller/src/main/java/cn/ova/web/UploadRest.java index 06eb1a895e2dbd20793a8eac502605ce132ba0d9..405186af03447326a1e8b1503f6e3ba8ae4ab8aa 100644 --- a/ova-boot/ova-seller/src/main/java/cn/ova/web/UploadRest.java +++ b/ova-boot/ova-seller/src/main/java/cn/ova/web/UploadRest.java @@ -83,10 +83,16 @@ public class UploadRest { } private String handleSaveFile(String tenant, String group, MultipartFile file) throws IOException { - String pathname = this.filepath(tenant, group, file.getOriginalFilename()); - File descFile = new File(this.savePath+"/"+pathname); +// String pathname = this.filepath(tenant, group, file.getOriginalFilename()); + String filepath = savePath + "/" + tenant+ "/"+ group; + File dir = new File(filepath); + if(!dir.exists()){ + dir.mkdirs(); + } + String fileName = fileName(file.getOriginalFilename()); + File descFile = new File( dir, fileName); file.transferTo(descFile); - return pathname; + return "/"+ tenant+ "/"+ group + "/" + fileName; } private String filepath(String tenant, String group, String originalFilename){