图片采集程序,将一个图片保存到本机上,并重新命名。
<% ‘================================================ ‘作 用:保存远程的文件到本地 ‘参 数: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,"http://image2.sina.com.cn/ent/v/m/2006-05-18/66cb006f0a8411644ac3da5b76c88c77.gif") response.write "保存成功" %> |