here is my image width and size code which is work perfectly but problem is that when i pass null fileupload it give me error ‘argument not valid ‘ but i want pass null value also how will i do
HttpPostedFile fil = this.FileUp.PostedFile;
System.Drawing.Image uploadimage = System.Drawing.Image.FromStream(fil.InputStream);
if (uploadimage.Height > 155 || uploadimage.Width > 124)
{
lblErrorMsg.Visible = true;
lblErrorMsg.Text = "<font class='orange'>Height and width not accpetable</font>";
return;
}
then check the
HasFileproperty of the FileUpload control before continuing…check here: FileUpload.HasFile Property