请教一段ASP代码是什么用意!

来源:百度知道 编辑:UC知道 时间:2024/04/30 08:18:31
Response.Clear
Response.ContentType = "application/ms-download"

Response.AddHeader "content-disposition", "attachment; filename=" & GetFileName( Mid(FileName, InStrRev(FileName, "/") + 1))
Set Stream = server.createObject("ADODB.Stream")
Stream.Type = adTypeBinary
Stream.Open

TrueFileName =FileName

Stream.LoadFromFile Server.MapPath(TrueFileName)
While Not Stream.EOS
Response.BinaryWrite Stream.Read(1024 * 64)
Wend
Stream.Close
Set Stream = Nothing

实在不懂这段代码是什么意思,请麻烦赐教下,谢谢!
最好帮我注解下,谢谢了!
Stream.Read(1024 * 64)
这一步是什么意思呢?
这个是一个下载的代码,可是下载大文件好像就不能用,是吧?

这段代码是下载服务器上的文件的操作。
Clear清空缓冲区的HTML输出
ContentType 属性指定服务器响应的 HTTP 内容类型application/ms-download就是下载了
下面的代码是对文件的路径,名称的操作,然后使用文件流,使用循环下载整个文件,直到结束,最后关闭文件流。

好像是一段上传下载的代码!