Hi sir,
I cant able to access the textbox value in AjaxFileUpload1_UploadComplete. I
attached the code below. Kindly give me the solution for this problem.
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string filepath = Server.MapPath("uploaded/") + e.FileName;
AjaxFileUpload1.SaveAs(filepath);
string s;
//Getting the empty value in string s
s = txt_uhid.Text;
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] photo = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
// int result;
SqlConnection con = new SqlConnection( WebConfigurationManager.ConnectionStrings["con"].ToString());
SqlCommand cmd;
con.Open();
string query = "insert into photos(uhid,picture) values(@uhid,@picturename)";
cmd = new SqlCommand(query, con);
cmd.Parameters.Add("@uhid", SqlDbType.VarChar).Value = txt_uhid.Text;
cmd.Parameters.Add("@picturename", SqlDbType.Image, photo.Length).Value = photo;
cmd.ExecuteNonQuery();
con.Close();
}
With regards,
J.Prabu.
[Email:prbspark@gmail.com]