private void UploadImages() { int CurrentProperty = PropertyData.GetLastPropertyID(); //Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + string LocalHostImagePath = "//ads//" + CurrentProperty + "//images//"; string ImageSavePath = Server.MapPath("~//ads//" + CurrentProperty + "//images//"); if (!Directory.Exists(Server.MapPath("~//ads//" + CurrentProperty))) { Directory.CreateDirectory(Server.MapPath("~//ads//" + CurrentProperty)); } if (!Directory.Exists(Server.MapPath("~//ads//" + CurrentProperty + "//images//"))) { Directory.CreateDirectory(Server.MapPath("~//ads//" + CurrentProperty + "//images//")); } for (int i = 0; i < Images.Count; i++) { PropertyData.UploadImage(LocalHostImagePath, ImageNames[i], CurrentProperty); PropertyData.SaveImage(ImageSavePath, ImageNames[i], Images[i]); } }