From 60ae29606292d09dcaed2f20e5284591adb24ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Mon, 11 Apr 2022 15:50:23 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/Controllers/System/SysProfileController.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/System/SysProfileController.cs b/ZR.Admin.WebApi/Controllers/System/SysProfileController.cs index 25f2b6b..4c9ead2 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysProfileController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysProfileController.cs @@ -134,9 +134,7 @@ namespace ZR.Admin.WebApi.Controllers.System LoginUser loginUser = Framework.JwtUtil.GetLoginUser(HttpContext); if (formFile == null) throw new CustomException("请选择文件"); - string fileExt = Path.GetExtension(formFile.FileName); - string fileName = FileUtil.HashFileName() + (fileExt.IsEmpty() ? ".png" : fileExt); - SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, fileName, "", HttpContext.GetName(), formFile); + SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, "", "", HttpContext.GetName(), formFile); UserService.UpdatePhoto(new SysUser() { Avatar = file.AccessUrl, UserId = loginUser.UserId }); return SUCCESS(new { imgUrl = file.AccessUrl });