Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP VBS Binary Download Problem

Status
Not open for further replies.

ColinMorgan

IS-IT--Management
Dec 20, 2001
4
GB
Hi,

I'm having a problem with this script snippet...

<%
' Perform download

response.buffer=true
response.clear


' get file name from querystring
Dim strFilePath, strFileName, strFileExtn, strDnldFileName
strFilePath = &quot;D:\inetpub\DBDir\&quot; &
strFileName = Request.QueryString(&quot;file&quot;)
strFileExtn = &quot;.mdb&quot;
strDnldFileName = Request.QueryString(&quot;file&quot;) & Year(date) & Month(date) & Day(date) & strFileExtn

'Create a stream object
Dim objStream
Set objStream = Server.CreateObject(&quot;ADODB.Stream&quot;)

'Open file
objStream.Type = 1 ' Type Binary
objStream.Open
objStream.LoadFromFile strFilePath & strFileName & strFileExtn

'Output the contents of the stream object
Response.AddHeader &quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; & strDnldFileName
Response.ContentType = &quot;application/octet-stream&quot;
Response.BinaryWrite objStream.Read

'Clean up....
objStream.Close
Set objStream = Nothing
Response.flush
%>

All works but any HTML or output code fails to run after
this has finished.

Any ideas?

Regards

Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top