How to update in entity without updating the file upload field

I would like to ask for help, you see I have an update method that doesn't work when the image upload input is empty. This shouldn't be the case since not fields are updated all the time. I am using Entity framework for my backend.


This is the code from the controller

public ActionResult Edit(int id, ClearanceDB clearanceDB)
        {
            try
            {
                string fileName = Path.GetFileNameWithoutExtension(clearanceDB.ImageFile.FileName);
                string extension = Path.GetExtension(clearanceDB.ImageFile.FileName);
                fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                clearanceDB.picture = "/Image/" + fileName;
                fileName = Path.Combine(Server.MapPath("/Image/"), fileName);
                clearanceDB.ImageFile.SaveAs(fileName);
                using (ClearanceModels dbModel = new ClearanceModels())
                {
                    dbModel.Entry(clearanceDB).State = EntityState.Modified;
                    //dbModel.Entry(clearanceDB).Property(p => p.ImageFile).IsModified = false;
                    dbModel.SaveChanges();
                }
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                //if (clearanceDB.ImageFile == null)
                //{
                //    dbModel.Entry(clearanceDB).Property(I => I.ImageFile).IsModified = false;
                //}
                return View();
            }
        }

as you can see in the commented sections I tried using the "IsModified" property to prevent the image from uploading but alas it is not working. I also tried checking if the image is null but it's also not working. Since I already tried the "IsModified" property and it is the most recurring solution that I find I don't know what else to try. Other solutions are too complicated I only need for the update to work without uploading a new image. Any help is appreciated thank you.


This is the ClearanceDB class Model, the picture is the only field causing this problem so I didn't put the other fields.

[Display(Name = "Picture")]
 //[Required(ErrorMessage = "Required!")]
public string picture { get; set; }

ublic HttpPostedFileBase ImageFile { get; set; }

Code from the view if that helps

<img src="@Html.DisplayFor(model => model.picture)" height="200" width="250" />
                <input type="file" name="ImageFile" value="@Html.DisplayFor(model => model.picture)">