<%
'Download the remote picture first
url=/"http://www.im286.com/image...'Remote picture 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
'End of renaming the file
setxmlhttp=server.createobject(/"Microsoft.XMLHTTP/")
xmlhttp.open/"get/",url,false
xmlhttp.send
img=xmlhttp.ResponseBody
setxmlhttp=nothing
setobjAdostream=server.createobject(/"ADODB.Stream/")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(savepath&filename&/".jpg/")
objAdostream.SetEOS
setobjAdostream=nothing
'File download ends
SetUpload=Server.CreateObject(/"Persits.Upload/")'Open object
SetFile=Upload.OpenFile(savepath&filename&/".jpg/")'Open the saved file
IfFile.ImageType<>/"JPG/"andFile.ImageType<>/"GIF/"andFile.ImageType<>/"BMP/"andFile.ImageType<>/"PNG/"Then
Upload.DeleteFilesavepath&filename&/".jpg/"'If the format is incorrect, delete this downloaded image
response.write/"Error image format/"
endif
'Log off the instance
SetUpload=nothing
SetFile=nothing
%>