public JsonResult UpLoadPushObject(string pushFile) { // var model = new ActionResultModel<string>(); UploadFile uf = new UploadFile(); uf.SetMaxSizeM(1000); //上传文件大小 string url = "/UpLoadFile/"; //文件保存路径 string saveFolder = Server.MapPath(url); uf.SetFileDirectory(saveFolder); string filesName = System.Web.HttpContext.Current.Request.Params["pushFile"]; HttpPostedFile file = System.Web.HttpContext.Current.Request.Files[filesName]; var reponseMessage = uf.Save(file, "PushObjectImport"); //保存文件 UploadHelper uploadHelper = new UploadHelper(); string readPath = Server.MapPath("/UpLoadFile/PushObjectImport/" + reponseMessage.FileName); DataTable dt = uploadHelper.GetDataByExcel(readPath); System.IO.File.Delete(readPath); if (dt == null || dt.Rows.Count == 0 || dt.Rows.Count == 1) { // model.respnseInfo = "2"; //表格为空 return(Json("2")); } else if (dt.Columns.Count != 2) { // model.respnseInfo = "3"; //模板不对 return(Json("3")); } else { try { var result = _dl.SearchUserId(dt); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { userId = "", exp = ex.Message })); } // model.respnseInfo = result.username; // model.isSuccess = ; // model.respnseInfo = model.isSuccess ? "1" : "0"; } //return Json(model, JsonRequestBehavior.AllowGet); }