Convert Image into a binary File and Save in TXT File

By Pankaj Pandey 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

Pankaj Pandey

Hello Friend,This is Pankaj Pandey, Software Developer on .net Platform.I have knowledge of  Development in C#, as well as Sql server,and worked on Dot net 1.1,2.0,3.5,4.0 and sql server 2005,2008.Also worked... Read more



Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs