zoukankan      html  css  js  c++  java
  • 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-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
  • 相关阅读:
    hortonworks
    使用Ambari快速部署Hadoop大数据环境
    js模板引擎
    Scala中的语言特性是如何实现的2
    IOS多线程编程一:概述
    Struts框架
    总体设计
    算法介绍
    社区与关怀
    从C#的Singleton设计模式
  • 原文地址:https://www.cnblogs.com/QDuck/p/563073.html
Copyright © 2011-2022 走看看