My problem is when I try to upload an image in asp.net mvc, i try this method :
public ActionResult Create(Regional regional, HttpPostedFileBase صورة)
{
if (ModelState.IsValid)
{
if (صورة != null)
{
صورة.SaveAs(Path.Combine(Server.MapPath("~/1"), صورة.FileName));
regional.صورة = صورة.FileName;
}
db.Regionals.Add(regional);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(regional);
}
and the input is :
<input type="file" id="صورة" name="صورة" accept="image/*" >
The problem is the name of the picture is saved in Database but the picture is not saved at the folder named "1", which is the Path.
please any help