public ActionResult FileUpload() { string relativePath = string.Empty; if (file != null) { // string ImageUniqueName = Guid.NewGuid().ToString(); //string ActualImageName = ImageUniqueName + Path.GetFileName(file.FileName); string pic = System.IO.Path.GetFileName(file.FileName); path = System.IO.Path.Combine(Server.MapPath("/images/profile"), pic); // file is uploaded file.SaveAs(path); relativePath = Path.Combine("/images/profile", ActualImageName); } return Json(relativePath, JsonRequestBehavior.AllowGet); }