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();
}
Nandha Kumar NagarajanPosted Jul 17, 2020, 2:42 AM
Prabu SparkPosted Aug 5, 2013, 4:00 AM
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.
Iftikar HussainPosted Aug 5, 2013, 3:11 AM
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