views:

604

answers:

1

I am using ASP.NET 2.0. I am trying to get the height & width of an image file I uploaded using the FileUpload control. Once uploaded, the image is kept in the db, not the file system. It seems I should be able to use something like the following code to do this but I can't get it to work.

Dim strm As Stream = oPostedFile.InputStream
dim i as image
i = System.Drawing.Image.FromStream(strm)
+1  A: 

I have found the solution.

Dim s As Stream = oPostedFile.InputStream
Dim i As Image = System.Drawing.Image.FromStream(s)

intFileWidth = i.PhysicalDimension.Width
intFileHeight = i.PhysicalDimension.Height