0

I am trying to upload the image in my project Releases folder. But it is not uploading in the desired place. Even though it shows the "file uploaded successfully" message.

image

Controller:

public ActionResult UploadImages(HttpPostedFileBase photo_url)
{         
    if (photo_url != null)
    try
    { 
        photo_url.SaveAs(Path.Combine(HttpContext.Server.MapPath("~/Images/Releases"), 
        photo_url.FileName));
        ViewBag.Message = "File uploaded successfully";
    }
    catch (Exception ex)
    {
        ViewBag.Message = "ERROR:" + ex.Message.ToString();
    }
    else
    {
        ViewBag.Message = "You have not specified a file.";
    }
    return View(); 
}
Peter B
  • 22,460
  • 5
  • 32
  • 69

0 Answers0