string filePath = Server.MapPath("AchTemplates/genACH.txt"); string filename = Path.GetFileName(filePath); FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); br.Close(); fs.Close(); string strQuery = "insert into tblFiles(FName,FData) values (@_FName, @_FData)"; MySqlCommand cmd = new MySqlCommand(strQuery); cmd.Parameters.Add("@_FName", MySqlDbType.VarChar).Value = filename; cmd.Parameters.Add("@_FData", MySqlDbType.LongBlob).Value = bytes; InsertUpdateData(cmd); // To get the data i used the following code private void download(DataTable dt) { Byte[] bytes = (Byte[])dt.Rows[0]["FData"]; //byte[] bytes = Encoding.UTF8.GetBytes(Convert.ToChar(dt.Rows[0]["FData"])); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); //Response.ContentType = dt.Rows[0]["ContentType"].ToString(); Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["FName"].ToString()); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); }