<%
'先下载远程图片
url="http://www.im286.com/image...'远程图片地址
savepath="D:photo"'保存路径
'为文件重命名
randomize
ranNum=int(999*rnd)
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
'为文件重命名结束
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
'文件下载结束
SetUpload=Server.CreateObject("Persits.Upload")'打开对象
SetFile=Upload.OpenFile(savepath&filename&".jpg")'打开已经保存的文件
IfFile.ImageType<>"JPG"andFile.ImageType<>"GIF"andFile.ImageType<>"BMP"andFile.ImageType<>"PNG"Then
Upload.DeleteFilesavepath&filename&".jpg"'如果格式不正确就删除这张已下载的图片
response.write"错误的图片格式"
endif
'注销实例
SetUpload=nothing
SetFile=nothing
%>