ASP文件下载用流输出的函数
来源:互联网 发布:js里getjson 编辑:程序博客网 时间:2024/05/21 18:32
ASP文件下载用流输出的函数和方法
asp中关于流的用法大家都已经很熟悉了,今天大学堂站长发布一个文件下载用asp流输出的方法,写成asp函数,代码如下:
<%
' 下载文件
function downloadfile(fullpath)
downloadfile = false
dim strfilename, s, fso, f, intfilelength
set fso = server.createobject("scripting.filesystemobject")
if not fso.fileexists(fullpath) then
exit function
end if
set f = fso.getfile(fullpath)
'获取文件大小
intfilelength = f.size
set s = server.createobject("adodb.stream")
s.open
s.type = 1
s.loadfromfile(fullpath)
response.buffer = true
response.clear
'response.addheader "Content-Encoding","GB2312" ' 乱码的解决方案
'response.addheader "content-type","application/x-msdownload"
response.addheader "content-disposition","attachment;filename=" & f.name
response.addheader "content-length" ,intfilelength
response.contenttype = "application/octet-stream"
while not s.eos
response.binarywrite s.read(1024 * 64)
response.flush
wend
s.close
set s = nothing
downloadfile = true
end function
%>
此代码经过大学堂站长测试,可以正常使用,特写成函数的形式,方便大家调用!
本文位置:大学堂>>程序设计>ASP文件下载用流输出的函数
标签:aspAsp源码程序设计
分类:程序设计| 发布:大学堂| 查看:3 | 发表时间:2011-6-16
原创文章如转载,请注明:转载自大学堂 http://www.dxtcc.com/
本文链接:http://www.dxtcc.com/program/156.html
- ASP文件下载用流输出的函数
- ASP使用流输出文件下载
- ASP使用流输出文件下载
- ASP.NET文件下载函数(好用的东东)
- 输出文件的下载
- ASP.NET利用输出流生成下载文件(doc、xml..)
- ASP.net文件下载函数
- asp.net文件下载函数
- ASP.NET文件下载函数
- ASP.NET文件下载函数
- ASP.NET文件下载函数
- ASP.NET文件下载函数
- ASP.NET文件下载函数
- ASP.NET文件下载函数
- asp.net 用流的方式下载文件
- ASP.NET提供文件下载函数
- ASP.NET提供文件下载函数
- ASP.NET提供文件下载函数(转载)
- 遗传算法入门--连载4
- 站长常用的网站联盟
- 今天开始学Java
- Linux平台VPN技术概论
- 黑客常用软件大全
- ASP文件下载用流输出的函数
- 遗传算法入门--连载5
- Qt的动态信号与槽机制
- JAVA高级视频02_IO输入与输出日记5(02-13到15)
- 遗传算法入门--连载6
- css加div下拉菜单源码
- 遗传算法入门--连载7
- js中的null值------一个问题的解决方案
- 校验