As I display an image recorded in the database, I believe it is not actually recorded, because I can only see the name / format of the image. In this case, how do I display this image?
I looked for some ways to do it using custom HTML helpers and etc., but I think I'm forgetting something.
Here is my image upload code:
[HttpPost]
public ActionResult Adicionar(usuario usuario, HttpPostedFileBase foto)
{
if (ModelState.IsValid)
{
db.usuario.Add(usuario);
db.SaveChanges();
var fotoperfil = Path.GetFileName(foto.FileName);
var caminho = Path.Combine(Server.MapPath("~/App_Data/Foto"), fotoperfil);
foto.SaveAs(caminho);
return RedirectToAction("Index");
}
return View(usuario);
}