在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
var logCfg = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "config/log4net.config"); XmlConfigurator.ConfigureAndWatch(logCfg); var logger = LogManager.GetLogger("log"); try { logger.Info("files:" + Request.Files.Count); logger.Info("filename:" + Request.Files[0].FileName); string filepath = Server.MapPath("/upload/"); Stream sin = Request.InputStream; string name = Request.QueryString["name"]; string fileExt = Path.GetExtension(Request.Files[0].FileName).ToLower(); string fileName = Guid.NewGuid().ToString() + fileExt; Request.Files[0].SaveAs(filepath + fileName); logger.Info("name:" + Request.Form["name"] + ";address:" + Request.Form["address"]); return Json(new { success="ok"}, JsonRequestBehavior.AllowGet); } catch (Exception ex) { logger.Error(ex.Message); return Json(new { success = "fail" }, JsonRequestBehavior.AllowGet); }
|
请发表评论