From 07c0ee4030735dbe920517f945fb48b4221454ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Wed, 12 Mar 2025 18:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/dc/app/controller/Base64Api.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dc-Vue/dc-admin/src/main/java/com/dc/app/controller/Base64Api.java b/dc-Vue/dc-admin/src/main/java/com/dc/app/controller/Base64Api.java index c81af0a..de25892 100644 --- a/dc-Vue/dc-admin/src/main/java/com/dc/app/controller/Base64Api.java +++ b/dc-Vue/dc-admin/src/main/java/com/dc/app/controller/Base64Api.java @@ -55,14 +55,16 @@ public class Base64Api { String filePath = DCConfig.getUploadPath(); // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); - fileName = fileName.replace("/profile/upload", ""); + String fileNameNew = FileUploadUtils.upload(filePath, file); + fileNameNew = fileNameNew.replace("/profile/upload", ""); String url = serverConfig.getUrl() + fileName; // 获取文件的 Base64 编码 - String path = filePath + File.separator + fileName; + String path = filePath + File.separator + fileNameNew; path = path.replace("profile", ""); String base64 = loadAsBase64(path); AjaxResult ajax = AjaxResult.success(); ajax.put("base64", base64); + ajax.put("url", fileName); return ajax; } catch (Exception e)