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
  • 相关阅读:
    ADO数据库操作
    AfxMessageBox和MessageBox区别
    Qt — 子窗体操作父窗体中的方法
    Qt — tableWidget插入复选框
    Qt & MySQL
    windows下安装Qt
    Extjs — Grid数据导出成Excel
    Mac终端 vi/vim 的简单使用
    iOS开发CocoaPods使用说明
    Shell 脚本学习笔记十:Shell输入输出重定向
  • 原文地址:https://www.cnblogs.com/QDuck/p/563073.html
Copyright © 2011-2022 走看看