http://www.brettb.com/ASPNETUploadImageSize.asp
Sample code comes from the above site. This is for the uploaded image, but it shows you how to get the informatics from the file stream:
private void ButtonUpload_Click(object sender, System.EventArgs e) {
string UploadedImageType = UploadedPicture.PostedFile.ContentType.ToString().ToLower();
string UploadedImageFileName = UploadedPicture.PostedFile.FileName;
System.Drawing.Image UploadedImage = System.Drawing.Image.FromStream(UploadedPicture.PostedFile.InputStream);
float UploadedImageWidth = UploadedImage.PhysicalDimension.Width;
float UploadedImageHeight = UploadedImage.PhysicalDimension.Height;
if (UploadedImageWidth > 600 || UploadedImageHeight > 400) {
Response.Write("This image is too big - please resize it!");
}
}
source
share