Remember that many editors and automatic collection systems use the function of automatically saving remote images. The general principle is to use the XMLHTTP object to retrieve images, and then write and save images with stream objects. Refer to the online code, I wrote one by myself, which is no different from the circulating code! The Code is as follows:
<%
Function saveremotefile (ssavepath, sremotefileurl)
On Error resume next
Saveremotefile = false
Dim oxml: Set oxml = server. Createobject ("Microsoft. XMLHTTP ")
With oxml
. Open "get", sremotefileurl, false ,"",""
. Send
If. Status <> 200 then exit function
Remotedate =. responsebody
End
Set oxml = nothing
Dim ostream: Set ostream = server. Createobject ("ADODB. Stream ")
With ostream
. Type = 1
. Open
. Write remotedate
. Savetofile ssavepath, 2
If err. Number = 0 then saveremotefile = true
. Close ()
End
Set ostream = nothing
End Function
'Call method:
Saveaddr = server. mappath ("demo.gif ")
Sourceurl = "http://www.google.cn/intl/zh-CN/images/logo_cn.gif"
Call saveremotefile (saveaddr, sourceurl)
%>