62,242
社区成员




public JsonResult Uploadify(HttpPostedFileBase Filedata)
{
string fileName = "D:\\1.jpg";
Filedata.SaveAs(fileName);
}
[HttpPost]
[ValidateInput(false)]
public ActionResult AssociationAdd(WzNews model)
{
if (ModelState.IsValid)
{
string filepath = Server.MapPath("~/CampusPic/");
HttpPostedFileBase ufile = Request.Files["FilePicture"];
if (ufile.ContentLength > 0)
{
string exname = System.IO.Path.GetExtension(ufile.FileName);
string nowfile = DateTime.Now.ToString("yyyyMMddHHmmss") + exname;
model.NewsPic = nowfile;
ufile.SaveAs(filepath + nowfile);
}
if (_newsService.WzNewsAdd(model) > 0)
return RedirectToAction("AssociationList", "WzNews");
else
ModelState.AddModelError("", "操作失败!");
}
return View(model);
}