public IActionResult UploadImage(Computer computer) { var photos = HttpContext.Request.Form.Files; if (photos != null) { foreach (var image in photos) { if (image != null) { string imgName = Path.GetFileName(image.FileName); string imgExt = Path.GetExtension(imgName); FileStream file = new FileStream(@"C:\Users\Dylan\Documents\School\ASP\labRepos\asp_lab12\HardwareEFCore\HardwareEFCore\wwwroot\Images\" + imgName, FileMode.Create); using (var ms = new MemoryStream()) { image.CopyTo(ms); ms.WriteTo(file); file.Close(); ms.Close(); computer.ImagePath = "/Images/" + imgName; } computerRepo.SaveComputer(computer); } } } else { return(View("List")); } return(RedirectToAction("List")); }