Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI,

I tried to convert image to string in C-Sharp ,asp.net and also check the username and image column in login page please sent me condition of fileuplod coding fully.

Here I Added my coding let me where is error and rectify me ASAP.

C#
if (TextBox1.Text !=  FileUpload1.PostedFile.FileName)
      {
          Response.Redirect("default.aspx");
Posted
Updated 24-Feb-11 0:13am
v2

This function convert BMP to String
public string ConvertImage(Bitmap tempBitmap)
{
MemoryStream objStream = new MemoryStream();
tempBitmap.Save(objStream, ImageFormat.Jpeg);
return Convert.ToBase64String(objStream.ToArray());
}


and how you call above function is mention below
public void convert_BMP_into_String()
{
Bitmap obj_Bitmap = new Bitmap(@"C:\temp.jpg");
string temp_String = ConvertImage(obj_Bitmap);
StreamWriter sw = new StreamWriter(@"C:\temp.text", false);
sw.Write(temp_String);
sw.Close();
}
 
Share this answer
 
Comments
Member 13234419 21-Jun-17 1:16am    
if i called in ton another page then it is work or not.
this[^] and Convert-Image-binary-format[^]might help you.
 
Share this answer
 
v2

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