<%
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 "Illegal link! "' Prevent hotlinking
Response.End
End If
If Request.Cookies ("logined") = "" Then
Response.Redirect "/login.asp" needs landing!
End If
Function GetFileName (longname) '/folder1/folder2/file.asp=>file.asp
While InStr (LongName, "/")
LongName = Right (Longname,len (longname)-1)
Wend
GetFileName = longname
End Function
Dim Stream
Dim Contents
Dim FileName
Dim Truefilename
Dim Fileext
Const adTypeBinary = 1
filename = request.querystring ("filename")
If FileName = "" Then
Response.Write "Invalid filename! "
Response.End
End If
Fileext = Mid (filename, InStrRev (filename, ".") + 1)
Select case UCase (Fileext)
Case "ASP", "ASA", "ASPX", "ASAX", "MDB"
Response.Write "Illegal Operation! "
Response.End
End Select
Response.Clear
If LCase (filename,3) = "gif" or LCase (right (filename,3) = "jpg" or LCase (right (filename,3)) = "png" Then
Response.ContentType = "image/*" does not appear on the image File Download dialog box
Else
Response.ContentType = "Application/ms-download"
End If
Response.AddHeader "Content-disposition", "attachment"; Filename= "& GetFileName (Request.QueryString (" FileName "))
Set Stream = server. CreateObject ("ADODB.") Stream ")
Stream.type = adTypeBinary
Stream.open
If LCase (right (filename,3) = "PDF" then "set PDF type file directory
Truefilename = "/the_pdf_file_s/" &filename
End If
If LCase (right (filename,3) = "Doc" then "Set Doc type file directory
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service