首页 > Web开发 > 详细

图片上传判断大小及宽高

时间:2017-10-27 12:19:22      阅读:282      评论:0      收藏:0      [点我收藏+]

此处上传一张图片示例:

技术分享
1   HttpPostedFileBase file_IO = request.Files[key]; //key==0
2 
3   System.IO.BinaryReader reader = new System.IO.BinaryReader(file_IO.InputStream);
4  byte[] file_Bytes = reader.ReadBytes(file_IO.ContentLength);           
5  var length = file_Bytes.Length;
6 
7   System.Drawing.Image image = System.Drawing.Image.FromStream(file_IO.InputStream);
8   var width = image.Width;   //px
9   var height = image.Height;   //单位是 px
View Code

 

 

图片上传判断大小及宽高

原文:http://www.cnblogs.com/leap-li/p/7742375.html

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