public JsonResult UploadCompanyLogo() { try { HttpFileCollectionBase col = Request.Files; if (col != null) { HttpPostedFileBase hpf = col[0]; string path = "~/Areas/DashBoard/Content/img/Custom/Company/"; string extension = Path.GetExtension(hpf.FileName); string fileName = RandomValueGenerator.GenerateRandomGuid(15) + extension; string logoPath = path + fileName; hpf.SaveAs(Server.MapPath(logoPath)); return(Json(new { Result = true, Logo = logoPath.Remove(0, 1) })); } } catch (Exception ex) { return(Json(new { Result = false, ex.Message })); } return(Json(new { Result = false, })); }