Use following code to convert image to bytes if(txt_fileupload.Text!="") // use an open file dialog to set required image path to txt_fileupload
{
filename = txt_fileupload.Text.Substring(Convert.ToInt32(txt_fileupload.Text.LastIndexOf("\")) + 1, txt_fileupload.Text.Length - (Convert.ToInt32(txt_fileupload.Text.LastIndexOf("\")) + 1));
filetype = txt_fileupload.Text.Substring(Convert.ToInt32(txt_fileupload.Text.LastIndexOf(".")) + 1, txt_fileupload.Text.Length - (Convert.ToInt32(txt_fileupload.Text.LastIndexOf(".")) + 1));
byte[] FileBytes = null;
FileStream FS = new FileStream(txt_fileupload.Text, System.IO.FileMode.Open, System.IO.FileAccess.Read);
BinaryReader BR = new BinaryReader(FS);
long allbytes = new FileInfo(txt_fileupload.Text).Length;
FileBytes = BR.ReadBytes((Int32)allbytes);
FS.Close();
FS.Dispose();
BR.Close();
string st = "insert into Files1(File_name,File_content,File_type) values ('" + filename + "','" + FileBytes + "','" + filetype + "')";
con.insert1(st); // function to insert data to db
MessageBox.Show("Images saved successfully");
txt_fileupload.Text = "";
}