HttpPostedFileBase file = Request.Files["imgfile"];var filePath = "/Upload/image/";var timeDirectory = DateTime.Now.ToString("yyyyMMdd");filePath = filePath + timeDirectory;if (!Directory.Exists(Server.MapPath(filePath))) { Directory.CreateDirectory(Server.MapPath(filePath)); }var fileName = Guid.NewGuid().ToString() + ".jpg";string Path = filePath + "/" + fileName;string allPath = Server.MapPath(Path);//保存图片file.SaveAs(allPath);
简单的图片上传
原文地址:https://www.cnblogs.com/shiyige-216/p/8607477.html