zoukankan      html  css  js  c++  java
  • 利用Stream下载文件

    Function dl(f,n)

        On error resume Next

        Set s=CreateObject("Adodb.Stream")

        s.Mode=3

        s.Type=1

        s.Open

        s.Loadformfile(f)

        if Err..Number>0 then

            Response.status="404"

        Else

            Response.ContentType="application/octet-stream"

            Response.AddHeader "Content-Disposition:","attachment;filename=" & n

            Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)

            if Range=" " then

                Response.BinaryWrite(s.Read)

            Else

                s.position=clng(split(Range,"-")(0))

                Response.BinaryWrite(s.Read)

            End If

        End if

        Response.End

    函数调用实例

    call dl(Server.MapPath("text.zip"),"test.zip")

  • 相关阅读:
    thinkphp SAE
    thinkphp rpc
    thinkphp REST
    thinkphp 图形处理
    thinkphp 验证码
    thinkphp 文件上传
    thinkphp 数据分页
    thinkphp 多语言支持
    thinkphp cookie支持
    thinkphp session支持
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2035761.html
Copyright © 2011-2022 走看看