Below the controller, I get the uploadImage parameter and I do Update DB, but the parameter is always null.
[HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "Id,Model,Color,YearOfIssue,Plate,Image")] Cars cars, HttpPostedFileBase uploadImage) { if (uploadImage != null) { byte[] imageData = null; using (var binaryReader = new BinaryReader(uploadImage.InputStream)) imageData = binaryReader.ReadBytes(uploadImage.ContentLength); cars.Image = imageData; } if (ModelState.IsValid) { db.Entry(cars).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(cars); } Slice from the Edit view
<div class="form-group"> @Html.LabelFor(model => model.Image, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> <input type="file" name="uploadImage" class="form-control" /> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Применить" class="btn btn-primary" /> </div> </div>