About file download

xiaoxiao2021-03-06  253

<% Function DL (f, n) on Error Resume Next Dim S = CreateObject ("AdoDb.Stream") S.Mode = 3 S.TYPE = 1 S.Open S.LoadFromFile (Server.MAppath (f)) if Err.Number> 0 then Response.Status = "404" else Response.ContentType = "application / *" Response.AddHeader "Content-Disposition:", "attachment; filename =" & n Range = Mid (Request.ServerVariables ( "Http_range", 7) if Range = "" "" ") Else 's.position = clng (split (Range," - ") (0)) Response.binaryWrite (S.READ) end if end if response.endend function

If Request ("Action") = "Down" THEN CALL DL (Request ("Path"), "aa.gif") endiff

%> Click to download this image