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
  • 相关阅读:
    混合背包
    庆功会(多重背包)
    商店选址问题(dij)(未完成)
    城市问题(dij)
    最短路径问题(dijkstra)
    城市问题(Floyd)
    商店选址问题(Floyd)
    差值中位数(二分答案+判定中位数)
    CF448C Painting Fence(分治)
    字符串+数论(扩展欧拉定理)
  • 原文地址:https://www.cnblogs.com/QDuck/p/563073.html
Copyright © 2011-2022 走看看