You must Sign In to post a response.
  • Category: .NET

    Multiple files Download...Pls.....Help.........

    select multplie file in listbox. it take first select item in listbox. next item error in

    "Server cannot append header after HTTP headers have been sent."
    how is handle.

    I want Multiple files Download in same time.
    pls hlp me

    LstFile is new listbox

    Protected Sub btnDownload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDownload.Click
    Dim k As String = LstFile.SelectedItem.Value
    For i As Integer = 0 To LstFile.Items.Count - 1
    If LstFile.Items(i).Selected = True Then
    Dim fs As FileStream
    Dim filesize As New Long
    fs = New FileStream(LstFile.Items(i).Value, FileMode.Open)
    filesize = fs.Length
    Dim buffer As Byte() = New Byte(CInt(filesize) - 1) {}
    fs.Read(buffer, 0, CInt(filesize))
    Response.Buffer = True
    'Dim attachFileName As String = LstFile.SelectedItem.Value.Substring(LstFile.SelectedItem.Value.LastIndexOf("\") + 1)
    Response.AddHeader("Content-disposition", "attachment;filename=" & LstFile.SelectedItem.Text & "")
    Response.ContentType = "application/octet-stream"
    Catch ex As Exception
    End Try
    End If

    adv thanks
  • #218814
    use itextsharp component for this

    you can download multiple file in .zip format


  • #218825
    thanks to u.

    i want normal format. want same time multiple files download from listbox fileitems.

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.