私はバナー画像を保存しようとしています。フォルダに保存する前に、それぞれのフォルダもチェックして作成していますが、チェックしてもエラーになりますフォルダが存在することを示します。コードは次のとおりです。パスの一部を見つけることができませんでした:Server.mapPath
HttpPostedFileBase banner = Request.Files["banner"];
if (banner != null && banner.ContentLength > 0) {
var folder = Server.MapPath("~/images/Continents/");
if (!Directory.Exists(folder)) {
Directory.CreateDirectory(folder);
}
banner.SaveAs(Server.MapPath("~/images/Continents/" + image.FileName));
string x = "/images/Continents/" + image.FileName;
continent.BANNER = x;
}
私には紛失しているものがありますか?
どの行でエラーを得ていますか? 'SaveAs'? – Shyju
の 'image'オブジェクトは何ですか?それはどこから来ていますか? – Shyju
私はこれが少しこの質問の重複していると思う[これを試してください](http://stackoverflow.com/questions/16357839/server-mappath-could-not-find-a-part-of-the-path-in- asp-net) – Ramki