Trying to find the author of a script

A

Arguich811

I use a script to force the browser to save instead of displaying a
simple text file. I downloaded the script some time ago and I don't
remember where I got it from. Does anyone recognize this script and if
so, do you know the author of this script:

------------------------------------
<%
' Constants for Reading Text File
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
Const TristateFalse = 0
Const TristateMixed = -2
Const TristateTrue = -1
Const TristateUseDefault = -2

' File System Objects
Dim FSO
Dim TS

' Server File (this is the REAL name of the file)
Dim strFile: strFile = Server.MapPath("mybas1.bas")

' File to Save As (this is the name you want to tell the browser)
Dim strFileSave: strFileSave = "mybas2.bas"

' Tell Browser what the file name is, so it doesn't try to save as
"default.asp"
Call Response.AddHeader("Content-Disposition","attachment;
filename=""" & strFileSave & """")

' Write out content-type that will FORCE user to SAVE FILE.
' "image/gif" will display in browser
Response.ContentType = "bad/type"

' Initialize File System Object
Set FSO = Server.CreateObject("Scripting.FileSystemObject")

' Open TextStream for Reading
Set TS = FSO.GetFile(strFile).OpenAsTextStream(ForReading,TristateTrue)

' TS.ReadAll DOES NOT WORK. Every Byte must be read and written
individually.
' I think you can read them in Chucks, but this was easier. If
you know how to
' Read chunks... go ahead, read chunks ;)
Do While Not (TS.AtEndOfStream)
' Output MUST be BinaryWrite
Response.BinaryWrite(TS.Read(1))
Loop

' Cleanup, like all good programmers do.
TS.Close
Set TS = Nothing
Set FSO = Nothing

' You don't need this, but I like it.
Response.End
%>
-------------------------------

Many thanks in advance,

Arguich811
Arguich811*digitalice*com
 
A

Arguich811

Thanks for your effort Evert Jan, but I had already Googled it and the
author of the referred posting has confirmed that he is not the
author.

Arguich811
arguich811*digitalrice*com
 
C

Chris Barber

A

Arguich811

Hi Chis,

No it doesn't matter who he /she is exactly, the script is just working
fine. I just would have liked to give the author some feedback so I hoped
someone might recognize it.

Arguich811
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top