首页 > 代码库 > .Net 上传图片之前获取图片的宽高

.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();

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