Binary system
Function Description: Upload picture files to the specified directory, in this file according to the URL incoming file name plus file directory based on the full path of the file. The file binary data stream is then written to the service page to hide the real address of the picture to prevent external reference to the image.
The following is a reference fragment:
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
Option Explicit
Const sysurl= "http://www.80Boby.com/uImg/"
Function readbinfile (fileName)
dim objstream,bin
set objstream = Server.CreateObject ("ADODB.") Stream ")
objstream.open
objstream.type = 1
objstream.loadfromfile filename
bin = objstream.read
objstream.close
readbinfile = Bin
End Function
Function Isselfrefer ()
Dim shttp_referer, sserver_name
Sserver_name = CSTR ( Request.ServerVariables ("Http_referer"))
If InStr (Sserver_name, "80boby.com") <>0 or InStr (Sserver_ Name, "freeat63.cn") <>0 then
Isselfrefer = true
else
Isselfrefer = false
End if& nbsp
End function
If request. QueryString ("Mark") = "Getpic" then
dim realurl,fso
dim ufilename:ufilename=request.querystring (" X ")
realurl=server.mappath (" File True path "&ufilename)
set fso = Server.CreateObject (" Scripting.filesystemObject ")
if not (FSO. FileExists (Realurl)) then Realurl=server.mappath ("logo.gif")
if not (isselfrefer) then
Realurl=server.mappath ("logo.gif")
end if
response.contenttype = "Image/jpeg"
Response. BinaryWrite readbinfile (realurl)
response.end
End If
%>