Response.binarywrite中的文件大小限制 [英] file size limit in Response.binarywrite

查看:507
本文介绍了Response.binarywrite中的文件大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码隐藏我网站上的文件下载URL。代码使用Response.Binarywrite将文件发送到客户端。

请指出使用此方法可以下载的文件的最大大小。

我正在托管此站点在公共服务器上,所以我将无法在Web服务器上进行任何更改。请指出可以采取哪些措施来确保上述方法对于任何文件大小下载仍然有效。


调用Response.AddHeader(" Content-Disposition"," attachment; filename = """& strFileSave&"""")

Response.ContentType =" bad / type"

设置Fsys =服务器.CreateObject(" Scripting.FileSystemObject")

设置TS = Fsys.GetFile(strFile).OpenAsTextStream(1,-1)

Do While Not(TS.AtEndOfStream )

Response.BinaryWrite(TS.Read(1))

循环

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

推荐答案

S N写道:
"S N" wrote:

我使用以下代码隐藏我网站上的文件下载URL。代码使用Response.Binarywrite将文件发送到客户端。

请指出使用此方法可以下载的文件的最大大小。

调用Response.AddHeader( " Content-Disposition"," attachment; filename ="""& strFileSave&"""")

Response.ContentType =" bad / type" ;

设置Fsys = Server.CreateObject(" Scripting.FileSystemObject")

设置TS = Fsys.GetFile(strFile).OpenAsTextStream(1,-1)

Do While Not(TS.AtEndOfStream)

Response.BinaryWrite(TS.Read(1))

循环
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



嗯......无论如何,那段代码都不适合工作。看方法

OpenAsTEXTstream

???


你真的只能可靠地使用FileSystemObject和文本文件;它不是用于处理二进制文件的



您需要使用ADODB.Stream对象。
http://msdn.microsoft.com/en- us / libr ... 32(VS.85).aspx


然后你可以通过
$轻松控制你在每个块中写的金额b $ b限制您每次阅读的金额。

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/libr...32(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.


感谢您的建议。我的印象是只能为数据库使用ADODB

。这是在文件上使用它的第一个例子。

你能否提供一个示例代码来隐藏下载网址,使用ADODB

流,同时应该没有限制文件大小为

下载。


..

Old Pedant < Ol ******* @ discussion.microsoft.com写信息

新闻:C3 ********************* ************* @ microsof t.com ...
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" <Ol*******@discussions.microsoft.comwrote in message
news:C3**********************************@microsof t.com...

" S N"写道:
"S N" wrote:

>我使用以下代码隐藏我的
网站上的文件下载URL。代码使用Response.Binarywrite将文件发送到客户端。
请使用此方法指示可以下载的文件的最大大小。
调用Response.AddHeader(Content-处置," attachment; filename ="""&
strFileSave&"""")
Response.ContentType =" bad / type"
设置Fsys = Server.CreateObject(" Scripting.FileSystemObject")
设置TS = Fsys.GetFile(strFile).OpenAsTextStream(1,-1)
Do While Not(TS.AtEndOfStream)
Response.BinaryWrite(TS.Read(1))
循环
>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



嗯......无论如何,代码都不适合工作。看方法

OpenAsTEXTstream

???


你真的只能可靠地使用FileSystemObject和文本文件;它是
不是

设计用于处理二进制文件。


您需要使用ADODB.Stream对象,而不是。
http:// msdn.microsoft.com/en-us/libr...32(SS.85).aspx


然后你可以很容易地控制你在每个中写的金额大块由

只是

限制你每次读取的金额。


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/libr...32(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.






" S N"写道:


"S N" wrote:

你能否提供一个示例代码来隐藏下载网址,使用ADODB

流,但是应该没有限制文件大小为

下载。
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.



好​​旧的Atrax有几个演示。


请注意,他的代码是用JScript编写的ASP,但转换到VBScript

应该很容易。

http://rtfm.atrax.co.uk/infinitemonk...es/asp/934.asp


http://rtfm.atrax.co.uk/ infinitemonk ... es / asp / 935.asp


如果您需要更多帮助,请询问。

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/infinitemonk...es/asp/934.asp
and
http://rtfm.atrax.co.uk/infinitemonk...es/asp/935.asp

If you need more help, ask.


这篇关于Response.binarywrite中的文件大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆