I have a asp.net app where a user will need to download multiple files at
once.
Below is some sample code I'm using to download a single file which works
perfectly, however, rather than a single file, I need to download all the
image files for a single order being processed by the user. Is it possible
to download a batch or group of files?
Thanks.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim sFilePath As String
Dim oFile As IO.FileInfo
'sFilePath = Request.QuerySt ring.Item("File Path")
sFilePath =
"C:\Inetpub\www root\Charmpix\I mages\ItemImage s\CustomPhotos\ 21207
_Image1.JPG"
oFile = New System.IO.FileI nfo(sFilePath)
' Clear the current output content from the buffer
Response.Clear( )
' Specify that the response is a stream that cannot be read by the
client and must be downloaded
'Response.Conte ntType = "applicatio n/octet-stream"
Response.Conten tType = "applicatio n/octet-stream; name=" &
oFile.Name
' Add the header that specifies the default filename for the
Download/SaveAs dialog
'Response.AddHe ader("Content-Disposition", "attachment filename=" &
oFile.Name)
Response.AddHea der("content-disposition", "attachment;fil ename=" &
oFile.Name)
' Add the header that specifies the file size, so that the browser
can show the download progress
Response.AddHea der("Content-Length", oFile.Length.To String())
' Send the file stream to the client
Response.WriteF ile(oFile.FullN ame)
' Stop the execution of this page
Response.End()
End Sub
--
mo*******@nospa m.com