When I use the following code in Controller
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
string path = Path.Combine(Server.MapPath("~/Images"),
Path.GetFileName(file.FileName));
file.SaveAs(path);
ViewBag.Message = "File Uploaded Successfully";
return View();
}
When I Run the Application I got the Following error
---Server Error in '/' Application.
---The resource cannot be found.
When I remove [HttpPost] it loads but file not uploaded…
Can any one help me?…….
Make sure you are creating the form like below,