From 9de31fa1e67da1937f4ed02084ada403a24751a4 Mon Sep 17 00:00:00 2001 From: tangzh Date: Wed, 16 Jul 2025 11:12:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/zhengjie/modules/front/rest/BusUserController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusUserController.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusUserController.java index b477fe9..cdfeea0 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusUserController.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusUserController.java @@ -94,11 +94,13 @@ public class BusUserController { throw new BadRequestException("只能上传图片"); } String type = FileUtil.getFileType(suffix); - File uploadFile = FileUtil.upload(file, fileProperties.getPath().getPath() + type + File.separator); + String path = fileProperties.getPath().getPath(); + File uploadFile = FileUtil.upload(file, path + type + File.separator); if(ObjectUtil.isNull(uploadFile)){ throw new BadRequestException("上传失败"); } - return new ResponseEntity<>(uploadFile.getName(), HttpStatus.OK); + String[] split = path.split("/"); + return new ResponseEntity<>("/" + split[split.length - 1] + "/" + type + "/" + uploadFile.getName(), HttpStatus.OK); } }