Skip to content

Commit

Permalink
Admin panel - allow the store owner to override logo file
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Jul 15, 2021
1 parent b1cd020 commit af0bf07
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/Web/Grand.Web.Admin/Controllers/PictureController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,28 @@ public virtual async Task<IActionResult> AsyncLogoUpload()
});
}
}
return Json(new
else
{
success = false,
message = "This filename exists"
});

var filepath = _mediaFileStore.GetDirectoryInfo("");
if (filepath != null)
{
using (var stream = new FileStream(_mediaFileStore.Combine(filepath.PhysicalPath, fileName), FileMode.OpenOrCreate))
{
httpPostedFile.CopyTo(stream);
}
return Json(new
{
success = true,
imageUrl = fileName
});
}
else
return Json(new
{
success = false,
message = "Physical path not exist"
});
}

}
}
Expand Down

0 comments on commit af0bf07

Please sign in to comment.