ローカル マシンでは以下のコードは正常に動作しますが、リモート サーバーでホストされている場合、イメージ ファイルが見つからないようです。Imageフォルダーを作成し、読み取り/書き込み権限も付与しました
// --------------------------------------------
エラー
Server Error in '/' Application.
Could not find file 'IdImage.jpg'.
説明: 現在の Web 要求の実行中に未処理の例外が発生しました。エラーの詳細とコード内のどこでエラーが発生したかについては、スタック トレースを確認してください。
Exception Details: System.IO.FileNotFoundException: Could not find file 'IdImage.jpg'.
コードは以下の通り
// ------------------------------------------------ -
[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");
}