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")

相关文章:

  • 2021-09-19
  • 2021-11-28
  • 2022-12-23
  • 2021-11-29
  • 2018-11-12
  • 2021-11-09
猜你喜欢
  • 2021-12-19
  • 2021-10-08
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案