public ActionResult EditHomeImage(string id, HttpPostedFileWrapper file) { string fileName = DateTime.Now.ToString("yyyyMMddhhssmm"); var vpath = Path.Combine("/img/", fileName + Path.GetExtension(file.FileName)); string path = Server.MapPath("~" + vpath); file.SaveAs(path); JObject obj = new JObject(); obj["path"] = vpath; obj["id"] = id; api.EditHomeImage(obj); return(RedirectToAction("HomeImages")); }