public ActionResult Create(Newstable newstable, HttpPostedFileBase file) { if (ModelState.IsValid && file != null && file.ContentLength > 0) { churchdbEntities1 db = new churchdbEntities1(); string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/nimage/" + ImageName); // save image in folder file.SaveAs(physicalPath); Newstable newRecord = new Newstable(); newRecord.Nhead= Request.Form["Nhead"]; newRecord.Ndate = Request.Form["Ndate"]; newRecord.Ntext = Request.Form["Ntext"]; newRecord.NUrl = "~/nimage/" + ImageName; db.Newstables.Add(newRecord); db.SaveChanges(); return RedirectToAction("Index"); } return View(newstable); }