修改文件存储
This commit is contained in:
@@ -110,13 +110,15 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
switch (storeType)
|
||||
{
|
||||
case StoreType.LOCAL:
|
||||
string savePath = AppSettings.App(new string[] { "Upload", "localSavePath" });
|
||||
if (savePath.IsEmpty())
|
||||
string savePath = Path.Combine(WebHostEnvironment.WebRootPath);
|
||||
if (fileDir.IsEmpty())
|
||||
{
|
||||
savePath = Path.Combine(WebHostEnvironment.WebRootPath, "uploads");
|
||||
fileDir = AppSettings.App(new string[] { "Upload", "localSavePath" });
|
||||
}
|
||||
file = await SysFileService.SaveFileToLocal(savePath, fileName, fileDir, HttpContext.GetName(), formFile);
|
||||
break;
|
||||
case StoreType.REMOTE:
|
||||
break;
|
||||
case StoreType.ALIYUN:
|
||||
if ((fileSize / 1024) > MaxContentLength)
|
||||
{
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
LoginUser loginUser = Framework.JwtUtil.GetLoginUser(HttpContext);
|
||||
if (formFile == null) throw new CustomException("请选择文件");
|
||||
|
||||
SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, "", "", HttpContext.GetName(), formFile);
|
||||
SysFile file = await FileService.SaveFileToLocal(hostEnvironment.WebRootPath, "", "avatar", HttpContext.GetName(), formFile);
|
||||
|
||||
UserService.UpdatePhoto(new SysUser() { Avatar = file.AccessUrl, UserId = loginUser.UserId });
|
||||
return SUCCESS(new { imgUrl = file.AccessUrl });
|
||||
|
||||
Reference in New Issue
Block a user