fix 头像上传问题
This commit is contained in:
parent
846652c1af
commit
60ae296062
@ -134,9 +134,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
LoginUser loginUser = Framework.JwtUtil.GetLoginUser(HttpContext);
|
LoginUser loginUser = Framework.JwtUtil.GetLoginUser(HttpContext);
|
||||||
if (formFile == null) throw new CustomException("请选择文件");
|
if (formFile == null) throw new CustomException("请选择文件");
|
||||||
|
|
||||||
string fileExt = Path.GetExtension(formFile.FileName);
|
SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, "", "", HttpContext.GetName(), formFile);
|
||||||
string fileName = FileUtil.HashFileName() + (fileExt.IsEmpty() ? ".png" : fileExt);
|
|
||||||
SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, fileName, "", HttpContext.GetName(), formFile);
|
|
||||||
|
|
||||||
UserService.UpdatePhoto(new SysUser() { Avatar = file.AccessUrl, UserId = loginUser.UserId });
|
UserService.UpdatePhoto(new SysUser() { Avatar = file.AccessUrl, UserId = loginUser.UserId });
|
||||||
return SUCCESS(new { imgUrl = file.AccessUrl });
|
return SUCCESS(new { imgUrl = file.AccessUrl });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user