I want to save file in my localdb how to convert fileName to absolute uri & pass it to my setImage Method
[HttpPost]
public async Task <IActionResult> UploadNewImage(IFormFile file, string title, string tags)
{
var content = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
var fileName = content.FileName.Trim('"');
await _imageService.SetImage(title, tags, uri);
return RedirectToAction("Index", "Gallery");
}
Here is my SetImage method
public async Task SetImage(string title, string tags, Uri uri)
{
var image = new GalleryImage
{
Title = title,
Tags = ParseTags(tags),
Url = uri.AbsolutePath,
Created = DateTime.Now
};
_ctx.Add(image);
await _ctx.SaveChangesAsync();
}