以下为引用的内容
<% FunctIon DownloadFIle(StrFIle)
StrFIlename=StrFIle
ResponseBuffer=True
ResponseClear
Set S=ServerCreateObJect("ADODBStream")
SOpen
SType=
on Error Resume Next
Set Fso=ServerCreateObJect("ScrIptIngFIleSystemObJect")
If Not FsoFIleExists(StrFIleName) Then
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "该文件不存在或者已经删除"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End If
FileExt=MId(StrFIlenameInStrRev(StrFIleName "")+)
Select Case UCase(FIleExt)
Case "ASP" "ASA" "ASPX" "ASAX" "MDB" "PHP" "JSP" "SHTML" "HTML" "HTM" "TV" "DATA"
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "该文件不存在或者已经删除"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End Select
Set F=FsoGetFIle(StrFIlename)
IntFIlelength=FSIze
sLoadFromFIle(StrFIlename)
If Err Then
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "该文件数据不完整或许已损坏"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End If
Set Upload=ServerCreateObJect("PersItsUpload")
If Upload Is Nothing Then
ResponseAddHeader "ContentDIsposItIon""attachment; FIlename="&FName
ResponseAddHeader "ContentLength"IntFilelength
ResponseCharSet="UTF"
ResponseContentType="application/xdownload"
ResponseBinaryWrite SRead
ResponseFlush
SClose
Set s=NothIng
Else
UploadSendBinary StrFIlenameTrue"application/xdownload"False
End If
End FunctIon
%>
调用
<%Call DownloadFIle("下载地址")%>