Pothi Sam

Pothi Sam

  • NA
  • 335
  • 50.7k

Download Multiple binary file from database

Jan 15 2019 10:16 PM
I Have A Binary File From database. I need To download multiple file at a time
 
This code is help to download Single File From Database i need to download multiple file at a time
  1. protected void download(object sender, EventArgs e)  
  2. {  
  3. con.Open();  
  4. SqlCommand cmd = new SqlCommand("select FileName, FileType, FileData from upload where Id=@id", con);  
  5. cmd.Parameters.AddWithValue("@id",((LinkButton)sender).CommandArgument);  
  6. SqlDataReader dr = cmd.ExecuteReader();  
  7. if (dr.Read())  
  8. {  
  9. Response.AddHeader("Content-Disposition""attachment;filename=\"" + dr["FileName"] + "\"");  
  10. Response.BinaryWrite((byte[])dr["FileData"]);  
  11. Response.End();  
  12. }  
  13. con.Close();  
  14. }  
  15. }  
  16. }  

Answers (1)