最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

ASP使用流输出文件下载技巧

日期:06-15    来源:中国设计秀    作者:cnwebshow.com

<%rZT中国设计秀
' 下载文件rZT中国设计秀
function downloadfile(fullpath)rZT中国设计秀

downloadfile = falserZT中国设计秀

dim strfilename, s, fso, f, intfilelengthrZT中国设计秀

set fso = server.createobject("scripting.filesystemobject")rZT中国设计秀

if not fso.fileexists(fullpath) thenrZT中国设计秀

rZT中国设计秀
exit functionrZT中国设计秀

end ifrZT中国设计秀

set f = fso.getfile(fullpath)rZT中国设计秀

'获取文件大小rZT中国设计秀

intfilelength = f.sizerZT中国设计秀

set s = server.createobject("adodb.stream")rZT中国设计秀

s.openrZT中国设计秀

s.type = 1rZT中国设计秀

s.loadfromfile(fullpath)rZT中国设计秀

response.buffer = truerZT中国设计秀

response.clearrZT中国设计秀

'response.addheader "Content-Encoding","GB2312" ' 乱码的解决方案rZT中国设计秀

'response.addheader "content-type","application/x-msdownload"rZT中国设计秀

response.addheader "content-disposition","attachment;filename=" & f.namerZT中国设计秀

response.addheader "content-length" ,intfilelengthrZT中国设计秀

response.contenttype = "application/octet-stream"rZT中国设计秀

while not s.eosrZT中国设计秀

rZT中国设计秀
response.binarywrite s.read(1024 * 64)rZT中国设计秀

rZT中国设计秀
response.flushrZT中国设计秀

wendrZT中国设计秀

s.closerZT中国设计秀

set s = nothingrZT中国设计秀

downloadfile = truerZT中国设计秀
end functionrZT中国设计秀
%>rZT中国设计秀

本文引用地址:/bc/article_46236.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明