<%
'Download the remote image first
Url = \ "http://www.im286.com/image... 'Remote Image address
Savepath = \ "D: \ photo \" 'Save path
'Rename the file
Randomize
Rannum = int (999 * RND)
Filename = year (now) & month (now) & Day (now) & hour (now) & minute (now) & Second (now) & rannum
'The End Of The file rename
Set XMLHTTP = server. Createobject (\ "Microsoft. XMLHTTP \")
XMLHTTP. Open \ "Get \", URL, false
XMLHTTP. Send
IMG = XMLHTTP. responsebody
Set XMLHTTP = nothing
Set objadostream = server. Createobject (\ "ADODB. Stream \")
Objadostream. open ()
Objadostream. type = 1
Objadostream. Write (IMG)
Objadostream. savetofile (savepath & filename & \ ". jpg \")
Objadostream. seteos
Set objadostream = nothing
'File download ended
Set upload = server. Createobject (\ "persits. Upload \") 'Open the object
Set file = upload. openfile (savepath & filename & \ ". jpg \") 'Open the saved file
If file. imagetype <> \ "JPG \" and file. imagetype <> \ "GIF \" and file. imagetype <> \ "BMP \" and file. imagetype <> \ "PNG \" then
Upload. deletefile savepath & filename & \ ". jpg \" 'Delete the downloaded image if the format is incorrect.
Response. Write \ "incorrect image format \"
End if
'Deregistering an instance
Set upload = nothing
Set file = nothing
%>