Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello everyone

I want to upload image and display???

I was upload the image and then convert it to binary then saved in the database and then call, Now i want only display image, please help me??
Here code below


C#
public void DisplayUploadedPhoto()
    {
        
        Class1 cl = new Class1();
        string ID = Session["IDUSER"].ToString();
        DataTable _T = cl._Get_PicInfoGV(" WHERE EmailID = '" + ID + "'");
        Byte[] bytes = (Byte[])_T.Rows[0]["PicData"];

        MemoryStream mstream = new MemoryStream(bytes);
        System.Drawing.Image img1 = System.Drawing.Image.FromStream(mstream);


       
    }
Posted
Updated 20-Jun-15 22:02pm
v2

 
Share this answer
 
I solved the problem.. thanks

C#
Class1 cl = new Class1();
        string ID = Session["IDUSER"].ToString();
        byte[] bytes = (byte[])cl._Get_PicInfoGV(" WHERE EmailID = '" + ID + "'").Rows[0]["PicData"];
        string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
        Image1.ImageUrl = "data:image/png;base64," + base64String; 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900