On the local machine the code below works fine, but when hosted on remote server it doesn't seem to find the image file. I created the Image folder and gave it read/ write permissions as well
// --------------------------------------------
Error
Server Error in '/' Application.
Could not find file 'IdImage.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not find file 'IdImage.jpg'.
Code is as below
// ---------------------------------------------
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
if (file != null && file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Images/Photo"), fileName);
file.SaveAs(path);
}
return RedirectToAction("Index");
}