How To Use the ADODB.Stream Object to Send Binary Files to the Browser through ASP

How To Use the ADODB.Stream Object to Send Binary Files to the Browser through ASP.

<%
'Set the content type to the specific type that you are sending.
Response.ContentType = "application/x-msexcel"

Const adTypeBinary = 1
Dim strFilePath

strFilePath = "C:\ExcelFiles\Excel1.xls" 'This is the path to the file on disk. 

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s