Wednesday, 30 December 2015

Check Upload Image size and height width using asp.net c#


protected void Btn_Upload(object sender, EventArgs e)
    {
        System.Drawing.Image img = System.Drawing.Image.FromStream(Upload_img.PostedFile.InputStream);
        int height = img.Height;
        int width = img.Width;
        decimal size = Math.Round(((decimal)Upload_img.PostedFile.ContentLength / (decimal)1024), 2);
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Size: " + size + "KB\\nHeight: " + height + "\\nWidth: " + width + "');", true);
      

    }

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...