网站知识
     搜索引擎 / Search
     推广文库 / SEO
     推荐工具 / Tools
     网站教程 /Tutorial
  
  我们做什么
  网站建设·网页设计 (
  网站策划·网站推广 (
  雅虎口碑壹推广 (ko
  谷歌搜索竞价 (Goo
  网站评估诊断 (Goo
  全站动画·创意设计 (
 
   您的位置在:首页 > 内蒙古巴彦淖尔市力天网络科技有限公司 > 网站知识
   网站知识
ASP使用流输出文件下载
[ 来源:新睿网   发布日期:2012-3-26 16:08:39 ]
收藏到: Del.icio.us Google书签 Digg Live Bookmark Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

<%
' 下载文件
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
%>

首页 | 公司简介 |联系方式 |付款方式 |人才招聘 | 域名空间 | 网页设计案例 | 网站知识 | 解决方案 | 建站指南
Copyright © 2011-2015 内蒙古巴彦淖尔市力天网络科技有限公司 All rights reserved
地址:内蒙古巴彦淖尔市中兴水郡西座212   邮编:015000   E- Mail:981268907@qq.com
咨询QQ:981268907 联系电话:13354789303