<%
Function saveremotefile (localfilename,remotefileurl)
saveremotefile=true
Dim Ads, Retrieval,getremotedata
Set retrieval = Server.CreateObject ("Microsoft.XMLHTTP")
with retrieval
. Open "Get", Remotefileurl, False, "", "
. Send
If. Readystate<>4 then
saveremotefile= False
Exit Function
End If
getremotedata =. Responsebody
End With
Set retrieval = no
Set Ads = Server.CreateObject ("ADODB.stream")
with Ads
& nbsp; . Type = 1
. Open
. Write getremotedata
. SaveToFile server. MapPath (LocalFilename), 2
. Cancel ()
. Close ()
End with
Set ads=nothing
End FuNction
%>
<%
' The following is an example of an invocation:
Remoteurl= "logo.gif" Remote file name (absolute full path)
Localfile=replace (replace (now (), "-", ""), "", ""), ":", "") &right (remoteurl,4) ' native filename (customizable)
If saveremotefile (localfile,remoteurl) =true Then
Response.Write ("Saved successfully:" &localfile)
End If
%>
-