public ActionResult Create(AppVersionInfo info) { if (string.IsNullOrEmpty(info.Version)) { return(Json(new APIJson(-1, "名称未填写"))); } HttpPostedFileBase FileMain = Request.Files["FileMain"]; if (null == FileMain) { return(Json(new APIJson(-1, "请选择文件"))); } string FilePathRelative = "/Content/AppVersion/"; string FileName = info.Version + ".zip"; string FileFullPath = Server.MapPath(FilePathRelative); if (!Directory.Exists(FileFullPath)) { Directory.CreateDirectory(FileFullPath); } FileMain.SaveAs(FileFullPath + FileName); info.SRC = FilePathRelative + FileName; info.CreateDate = DateTime.Now; AppVersionBLL.Create(info); if (info.ID > 0) { return(Json(new APIJson(0, "添加成功", new { info.ID, info.Version }))); } return(Json(new APIJson(-1, "添加失败"))); }