From: S N on
I am using the following code to hide the download url of files on my website. The code uses Response.Binarywrite to send file to the client.
Kindly indicate the maximum size of the file that can be downloaded using this method.
I am hosting this site on a public server, so I will not be able to change anything on the webserver. Kindly indicate what can be done to ensure that the above method remains valid for any file size download.

call Response.AddHeader("Content-Disposition","attachment; filename=""" & strFileSave & """")
Response.ContentType = "bad/type"
Set Fsys = Server.CreateObject("Scripting.FileSystemObject")
Set TS = Fsys.GetFile(strFile).OpenAsTextStream(1, -1)
Do While Not (TS.AtEndOfStream)
Response.BinaryWrite(TS.Read(1))
Loop
From: Old Pedant on
"S N" wrote:

> I am using the following code to hide the download url of files on my website. The code uses Response.Binarywrite to send file to the client.
> Kindly indicate the maximum size of the file that can be downloaded using this method.
> call Response.AddHeader("Content-Disposition","attachment; filename=""" & strFileSave & """")
> Response.ContentType = "bad/type"
> Set Fsys = Server.CreateObject("Scripting.FileSystemObject")
> Set TS = Fsys.GetFile(strFile).OpenAsTextStream(1, -1)
> Do While Not (TS.AtEndOfStream)
> Response.BinaryWrite(TS.Read(1))
> Loop

Ummm...that code isn't goint to work, anyway. See the method
OpenAsTEXTstream
???

You really can only use FileSystemObject reliably with text files; it wasn't
designed to work with binary files.

You need to use ADODB.Stream object, instead.
http://msdn.microsoft.com/en-us/library/ms675032(VS.85).aspx

And then you could easily control the amount you write in each chunk by just
limiting the amount you Read each time.
From: S N on
Thanks for the advice. I was under the impression that ADODB can be used
only for databases. This is the first instance of using it on files.
Can you please provide a sample code to hide download url by using ADODB
stream, while there should be no limit on the size of files to be
downloaded.

..
"Old Pedant" <OldPedant(a)discussions.microsoft.com> wrote in message
news:C37071C4-3FB6-446F-BF6A-3755BFEC28BE(a)microsoft.com...
> "S N" wrote:
>
>> I am using the following code to hide the download url of files on my
>> website. The code uses Response.Binarywrite to send file to the client.
>> Kindly indicate the maximum size of the file that can be downloaded using
>> this method.
>> call Response.AddHeader("Content-Disposition","attachment; filename=""" &
>> strFileSave & """")
>> Response.ContentType = "bad/type"
>> Set Fsys = Server.CreateObject("Scripting.FileSystemObject")
>> Set TS = Fsys.GetFile(strFile).OpenAsTextStream(1, -1)
>> Do While Not (TS.AtEndOfStream)
>> Response.BinaryWrite(TS.Read(1))
>> Loop
>
> Ummm...that code isn't goint to work, anyway. See the method
> OpenAsTEXTstream
> ???
>
> You really can only use FileSystemObject reliably with text files; it
> wasn't
> designed to work with binary files.
>
> You need to use ADODB.Stream object, instead.
> http://msdn.microsoft.com/en-us/library/ms675032(VS.85).aspx
>
> And then you could easily control the amount you write in each chunk by
> just
> limiting the amount you Read each time.
>


From: Old Pedant on


"S N" wrote:

> Can you please provide a sample code to hide download url by using ADODB
> stream, while there should be no limit on the size of files to be
> downloaded.

Good old Atrax has a couple of demos.

Note that his code is written in JScript for ASP, but conversion to VBScript
should be easy.

http://rtfm.atrax.co.uk/infinitemonkeys/articles/asp/934.asp
and
http://rtfm.atrax.co.uk/infinitemonkeys/articles/asp/935.asp

If you need more help, ask.
From: S N on
I would be grateful if you can give me vbscript code as well.
I would also like to clarify that the code for jscript forces save as
dialog. What if we want to hide the download url but dont want to force the
save as dialog, instead just want to see the pdf file within the browser
window itself.
Kindly advise on this.

Thanks in anticipation.

"Old Pedant" <OldPedant(a)discussions.microsoft.com> wrote in message
news:03E3B997-93DE-4D4B-8C49-F5102BB39CEA(a)microsoft.com...
>
>
> "S N" wrote:
>
>> Can you please provide a sample code to hide download url by using ADODB
>> stream, while there should be no limit on the size of files to be
>> downloaded.
>
> Good old Atrax has a couple of demos.
>
> Note that his code is written in JScript for ASP, but conversion to
> VBScript
> should be easy.
>
> http://rtfm.atrax.co.uk/infinitemonkeys/articles/asp/934.asp
> and
> http://rtfm.atrax.co.uk/infinitemonkeys/articles/asp/935.asp
>
> If you need more help, ask.
>