复制代码 代码如下:
<%
'================================================
' 函数名:SaveRemoteFile
' 作 用:保存远程文件到本地
' 参 数:strFileName ----保存文件的名称
' strRemoteUrl ----远程文件URL
' 返回值:布尔值 True/False
'================================================
Function SaveRemoteFile(ByVal strFileName, ByVal strRemoteUrl)
Dim oStream, Retrieval, GetRemoteData
SaveRemoteFile = False
On Error Resume Next
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
Retrieval.Open "GET", strRemoteUrl, False, "", ""
Retrieval.Send
If Retrieval.readyState <> 4 Then Exit Function
If Retrieval.Status > 300 Then Exit Function
GetRemoteData = Retrieval.ResponseBody
Set Retrieval = Nothing
If LenB(GetRemoteData) > 100 Then
Set oStream = Server.CreateObject("Adodb.Stream")
oStream.Type = 1
oStream.Mode = 3
oStream.Open
oStream.Write GetRemoteData
oStream.SaveToFile Server.MapPath(strFileName), 2
oStream.Cancel
oStream.Close
Set oStream = Nothing
Else
Exit Function
End If
If Err.Number = 0 Then
SaveRemoteFile = True
Else
Err.Clear
End If
End Function
%>
复制代码 代码如下:
<%
Class Download_Cls
Private sUploadDir
Private nAllowSize
Private sAllowExt
内容版权声明:除非注明,否则皆为本站原创文章。