一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp 保存远程服务器图片到本地

时间:2022-07-02 23:11:22 编辑:袖梨 来源:一聚教程网

'==================================================
'过程名:SaveRemoteFile
'作 用:保存远程的文件到本地
'参 数:LocalFileName ------ 本地文件名
'参 数:RemoteFileUrl ------ 远程文件URL
'==================================================
sub SaveRemoteFile(LocalFileName,RemoteFileUrl)
dim Ads,Retrieval,GetRemoteData
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
  .Open "Get", 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(ImgPath&LocalFileName),2
  .Cancel()
  .Close()
End With
Set Ads=nothing
end Sub

热门栏目