Step 1. Import these two namespaces in your application. If you don't have an application, create a new Web application using Visual Studio and C#.
using System.IO;
using System.Net;
Step 2. Add a Upload File control and a button to the default WebForm.
Step 3. Write this code on the button click event handler. This code converts the selected image into a byte array and saves that into a text file.
  1. protected void Button1_Click(object sender, EventArgs e)
  2. {
  3. string str = FileUpload1.FileName.ToString();
  4. FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Images/" + str.ToString()));
  5. byte[] imgbyte =File.ReadAllBytes(Server.MapPath("~/Images/" + str.ToString()));
  6. File.WriteAllBytes(Server.MapPath("~/Images/image1.txt"), imgbyte);
  7. }
For more details, download the zip code.
Thanks