asp函数:SaveRemoteFile
作者:cmscn 日期:2009-06-11
程序代码
'============================================
'函数名:SaveRemoteFile
'作 用:远程文件自动保存到本地服务器
'参数:RemoteFileUrl ------远程文件URL
'参数:LocalFileName ------本地文件名
'============================================
Sub SaveRemoteFile(RemoteFileUrl,LocalFileName)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
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 LocalFileName, 2
.Cancel()
.Close()
End With
Set Ads=nothing
End Sub
评论: 0 | 引用: 0 | 查看次数: 446
发表评论