The following are the referenced content:
<% FunctIon DownloadFIle (strfile)
Strfilename=strfile
response.buffer=true
Response.Clear
Set s=server.createobject ("ADODB. Stream ")
S.open
s.type=1
on Error Resume Next
Set fso=server.createobject ("Scripting.FileSystemObject")
If not fso.fileexists (strFileName) Then
From_url=cstr (Request.ServerVariables ("Http_referer"))
Serv_url=cstr (Request.ServerVariables ("SERVER_NAME"))
If MId (From_url,8,len (serv_url)) <> Serv_url Then
Response.Write "The file does not exist or has been deleted."
Response.End
End If
Response.Redirect request.servervariables ("Http_referer")
Response.End
End If
Fileext=mid (Strfilename,instrrev (strFileName, ".") +1)
Select case UCase (fileext)
case "ASP", "ASA", "ASPX", "ASAX", "MDB", "PHP", "JSP", "SHTML", "HTML", "HTM", "TV", "DATA"
From_url=cstr (Request.ServerVariables ("Http_referer"))
Serv_url=cstr (Request.ServerVariables ("SERVER_NAME"))
If MId (From_url,8,len (serv_url)) <> Serv_url Then
Response.Write "The file does not exist or has been deleted."
Response.End
End If
Response.Redirect request.servervariables ("Http_referer")
Response.End
End Select
Set f=fso.getfile (strFileName)
intfilelength=f.size
s.loadfromfile (strFileName)
If ERR Then
From_url=cstr (Request.ServerVariables ("Http_referer"))
Serv_url=cstr (Request.ServerVariables ("SERVER_NAME"))
If MId (From_url,8,len (serv_url)) <> Serv_url Then
Response.Write "The file data is incomplete or corrupted."
Response.End
End If
Response.Redirect request.servervariables ("Http_referer")
Response.End
End If
Set upload=server.createobject ("Persits.upload")
If Upload is nothing Then
Response.AddHeader "content-disposition", "attachment;" Filename= "&f.name
Response.AddHeader "Content-length", Intfilelength
response.charset= "UTF-8"
response.contenttype= "Application/x-download"
Response.BinaryWrite S.read
Response.Flush
S.close
Set s=nothing
Else
upload.sendbinary strfilename,true, "Application/x-download", False
End If
End FunctIon
%> |
Call
<%call DownloadFIle ("Download Address")%>