圖片采集程序,將一個圖片保存到本機上,並重新命名。
<%
'================================================
'作 用:保存遠程的文件到本地
'參 數:LocalFileName ------ 本地文件名
' RemoteFileUrl ------ 遠程文件URL
'返回值:True ----成功
' False ----失敗
'================================================
Sub SaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
Dim Ads, RetrIEval, GetRemoteData
On Error Resume Next
Set RetrIEval = Server.CreateObject("Microsoft.XMLHTTP")
With RetrIEval
.Open "Get", s_RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set RetrIEval = Nothing
Set Ads = Server.CreateObject("Adodb.Stream")
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(s_LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads=nothing
End Sub
%>
<%
path="./pic/1.gif"
Call SaveRemoteFile(path,"/School/UploadFiles_7810/201603/20160320221945399.gif")
response.write "保存成功"
%>