首页 > Web开发 > 详细

简单的图片上传

时间:2018-03-20 10:22:43      阅读:185      评论:0      收藏:0      [点我收藏+]
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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!