Question
steam text to file download
I'm re-posting this as it's a new week and I'm still a little
stuck.
Basically, I need to stream content to a file (CSV) and deliver straight to
the user (no server storage). I've tried the following both on my local XP
machine and the remote server (windows server 2003). In both cases the
script creates a file for download but the file is empty. Any illumination
would be much appreciated.
<%
Response.ContentType = "text/csv"
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 2
objStream.Open
objStream.WriteText "this is my content"
Response.addHeader "content-disposition","attachment;filename=myfile.csv"
Response.BinaryWrite objStream.ReadText
objStream.Close
Set objStream = Nothing
%>
Many thanks
Justin
Basically, I need to stream content to a file (CSV) and deliver straight to
the user (no server storage). I've tried the following both on my local XP
machine and the remote server (windows server 2003). In both cases the
script creates a file for download but the file is empty. Any illumination
would be much appreciated.
<%
Response.ContentType = "text/csv"
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 2
objStream.Open
objStream.WriteText "this is my content"
Response.addHeader "content-disposition","attachment;filename=myfile.csv"
Response.BinaryWrite objStream.ReadText
objStream.Close
Set objStream = Nothing
%>
Many thanks
Justin