Blog

Convert Image into a binary File and Save in TXT File

Posted by Pankaj Pandey Blogs | ASP.NET Programming May 08, 2013
Convert Image into a binary File and Save in TXT File.
Download Files: imagetobinary.rar
Step 1. Add Given namespaces 

using System.IO;
using System.Net;

Step 2. Add a Upload File control and a button

Step 3. Write this code on button click event

protected void Button1_Click(object sender, EventArgs e)
{
    string str = FileUpload1.FileName.ToString();
    FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Images/" + str.ToString()));
    byte[] imgbyte =File.ReadAllBytes(Server.MapPath("~/Images/" + str.ToString()));
    File.WriteAllBytes(Server.MapPath("~/Images/image1.txt"), imgbyte);
}

For more download the zip code

Thanks
COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
Employers - Post Free Jobs
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
Employers - Post Free Jobs