.Net 上传图片之前获取图片的宽高

                Stream st = Request.Files[0].InputStream; 
                Byte[] buffer = new Byte[st.Length];
                st.Read(buffer, 0, buffer.Length);
                MemoryStream stream = new MemoryStream(buffer);   
                Bitmap img = new Bitmap(stream);
                int width = img.Width;
                int height = img.Height;
                stream.Close();
                st.Close();

posted @ 2016-09-26 17:25  张三~~  阅读(768)  评论(0编辑  收藏  举报