05月 29th, 2006

[ASP]保存远程的文件到本地

Category: 技术资源代码, Author: hosend, Popularity: 14%

‘==========================================
‘过程名:SaveRemoteFile
‘作 用:保存远程的文件到本地
‘参 数:LocalFileName —— 本地文件名
‘参 数:RemoteFileUrl —— 远程文件URL
‘==========================================
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 = Nothing
Set Ads = Server.CreateObject(”Adodb.Stream”)
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile server.MapPath(LocalFileName),2
.Cancel()
.Close()
End With
Set Ads=nothing
end Function

Popularity: 14%


评论数量(0) | Add Comments
本文网址:http://blog.insome.com/2006/05/29/354.html

随机日志

There are No comments.

» You can leave a response or Trackback .

leave a reply

You must be logged in to post a comment.