How to download multiple files using asp and C#

后端 未结 1 817
误落风尘
误落风尘 2020-12-06 15:13

I\'m pretty new at this, so bear with me. Here\'s my code. It only downloads one file even though multiple are selected.

foreach(String fileName in fileNameL         


        
相关标签:
1条回答
  • 2020-12-06 15:26

    that is not the way to go, you can either zip all selected files server side and download only the zip file or you can try to use client side code to open multiple download windows, but in that case I think some browsers could potentially block the popups with their popup blockers.

    something like, you create a page called download.aspx ( or even just an http handler ) then you call it multiple times via JavaScript:

    window.open("download.aspx?id=id of file1");
    window.open("download.aspx?id=id of file2");
    

    check here for some ideas you can further elaborate: ASP.NET Download Multiple files

    0 讨论(0)
提交回复
热议问题