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

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...