M
moondaddy
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.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim sFilePath As String
Dim oFile As IO.FileInfo
'sFilePath = Request.QueryString.Item("FilePath")
sFilePath =
"C:\Inetpub\wwwroot\Charmpix\Images\ItemImages\CustomPhotos\21207
_Image1.JPG"
oFile = New System.IO.FileInfo(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.ContentType = "application/octet-stream"
Response.ContentType = "application/octet-stream; name=" &
oFile.Name
' Add the header that specifies the default filename for the
Download/SaveAs dialog
'Response.AddHeader("Content-Disposition", "attachment filename=" &
oFile.Name)
Response.AddHeader("content-disposition", "attachment;filename=" &
oFile.Name)
' Add the header that specifies the file size, so that the browser
can show the download progress
Response.AddHeader("Content-Length", oFile.Length.ToString())
' Send the file stream to the client
Response.WriteFile(oFile.FullName)
' Stop the execution of this page
Response.End()
End Sub
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.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim sFilePath As String
Dim oFile As IO.FileInfo
'sFilePath = Request.QueryString.Item("FilePath")
sFilePath =
"C:\Inetpub\wwwroot\Charmpix\Images\ItemImages\CustomPhotos\21207
_Image1.JPG"
oFile = New System.IO.FileInfo(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.ContentType = "application/octet-stream"
Response.ContentType = "application/octet-stream; name=" &
oFile.Name
' Add the header that specifies the default filename for the
Download/SaveAs dialog
'Response.AddHeader("Content-Disposition", "attachment filename=" &
oFile.Name)
Response.AddHeader("content-disposition", "attachment;filename=" &
oFile.Name)
' Add the header that specifies the file size, so that the browser
can show the download progress
Response.AddHeader("Content-Length", oFile.Length.ToString())
' Send the file stream to the client
Response.WriteFile(oFile.FullName)
' Stop the execution of this page
Response.End()
End Sub