Last Updated: February 25, 2016
·
1.054K
· iondrimba

Verify image dimensions on upload!

using System.Drawing;

Stream inputStream = httpContext.Request.Files[0].InputStream;
using(Image img = Image.FromStream(inputStream))
    {   
        if( img.Width < 640 && img.Height < 480)
        {
                throw new Exception("your error message");
        }
    }