Hi sir,
Tell me the steps to download multi files using asp.net c#. I stored the filenames in string array and put in for loop, but for loop is going one time only. i attached the code for your reference. Kindly give me the solution for this problem.
[Note: Because of Response.End() it will not go to next value increment in for loop]
protected void Page_Load(object sender, EventArgs e)
{
string[] values = { "setup1.apk", "setup1.apk" };
for (int i = 0; i < values.Length; i++)
{
downloadfiles(values[i]);
}
}
private void downloadfiles(string filename)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/msi";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename);
Response.TransmitFile(Server.MapPath("~/jad/") + filename);
Response.End();
}

Iftikar HussainRank #423 · 5.9K reputationPosted Aug 4, 2013, 11:11 PM EDT
This way you can't download multiple files. You need to ZIP all files and download that zip file.
Please refer the below link for downloading multiple file by zipping
http://www.aspdotnet-suresh.com/2013/04/aspnet-download-multiple-files-as-zip.html
Regards,
Iftikar
Prabu Spark114 reputationPosted Aug 5, 2013, 12:00 AM EDT
I dont want in zip format because i download that two apk files in mobile and install it. How can i unzip that file in mobiles. Kindly tell me how to download as separate files.
Nandha Kumar NagarajanRank #6,237 · 272 reputationPosted Jul 16, 2020, 10:42 PM EDT