Hi there,
I have a database which contains the paths of different files, what I want to do is to store the paths in an array to create an array of paths then download these files with one click.

How to do that?
please help

Recommended Answers

All 6 Replies

how to download multiple files with one click, I have the paths in an array

i did that but got nothing

this is the code

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim i As Integer = 0
            Dim pp() As String = {"F:\New folder (2)\1. pdf", "F:\New folder (2)\2.txt", "F:\New folder (2)\3.docx"}
            Dim files As New List(Of ListItem)()
            For Each filePath As String In pp
                files.Add(New ListItem(pp(i)))
                i = i + 1
            GridView1.DataSource = files
        End If
    End Sub

    Protected Sub btnDownload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDownload.Click
        Using zip As New ZipFile()
            zip.AlternateEncodingUsage = ZipOption.AsNecessary
            For Each row As GridViewRow In GridView1.Rows
                Dim filePath As String = TryCast(row.FindControl("lblFilePath"), Label).Text
                zip.AddFile(filePath, "files")
            Response.BufferOutput = False
            Dim zipName As String = [String].Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"))
            Response.ContentType = "application/zip"
            Response.AddHeader("content-disposition", "attachment; filename=" + zipName)
        End Using
    End Sub

thanks to myself

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.