January 21st, 2013, 11:49 AM
Join Date: Jan 2013
Time spent in forums: 11 m 20 sec
Reputation Power: 0
Classic ASP - Need help with download text file
I am creating a text file, that once created is to be downloaded. I have the file being created and saved on the server, the problem I am having is getting the download/open dialog to work. The following is my current code and while this works to a point, the file the user receives is a text file containing html code along with the contents of the actual file.
Any and all help is appreciated.
Const adTypeBinary = 1
strFileName = "test.txt"
strFilePath = "c:\extracts\" + strFileName
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.Charset = "UTF-8"
Response.ContentType = "image/jpeg"