sameer khan

sameer khan

  • NA
  • 8
  • 10.2k

Embeding the image in html editor

Dec 15 2006 5:05 AM

FileStream fs = null;

fs = new FileStream(filepath, FileMode.Open);

StreamReader sr = new StreamReader(fs);

string s = sr.ReadToEnd();

System.Text.StringBuilder sbText = new System.Text.StringBuilder(s, s.Length);

sbText.Replace("\r\n", String.Empty);

sbText.Replace(" ", String.Empty);

Byte[] imageBytes = new Byte[sbText.Length];

imageBytes = System.Text.Encoding.Default.GetBytes(sbText.ToString());

string strBase64 = Convert.ToBase64String(imageBytes);

byte[] byteresponse = Convert.FromBase64String(strBase64);

System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(byteresponse);

Bitmap bitImage = new Bitmap((Bitmap)System.Drawing.Image.FromStream(streamBitmap));


Error in last line
Parameter is not valid
plz help me