ASP.NET如何获取上传图片的宽和高

ASP.NET如何获取上传图片的宽和高

采用流取得图片大小 

  •  
  • C# 代码   复制
  • 
    HttpPostedFile file = this.Request.Files["上传控件Name"];
    Stream stream = file.InputStream;
    System.Drawing.Image image = System.Drawing.Image.FromStream(stream);
    
    int iWidth=Image.Width
    int iHeight=Image.Height
    
    		
  • 标签: