I used file upload to insert the file path on DB and the uploaded file on file on the project directory , I added my code but It didn't worked well.
<div class="editor-field create-Bt2"> @Html.EditorFor(model => model.Active) @Html.ValidationMessageFor(model => model.Active) </div> <div> <p class="create-Bt "> <input type="submit" value="Create" /> </p> </div> [HttpPost] public ActionResult Create(Category category) { if (ModelState.IsValid) { var fileName = ""; var fileSavePath = ""; var uploadedFile = Request.Files[0]; fileName = Path.GetFileName(uploadedFile.FileName); fileSavePath = Server.MapPath("../../Uploads/" + fileName); uploadedFile.SaveAs(fileSavePath); db.Categories.Add(category); db.SaveChanges(); return RedirectToAction("Index"); } return View(category); }