主题:  找版主小田

junner

职务:普通成员
等级:1
金币:0.0
发贴:5
注册:2003/5/7 9:33:02
#12003/8/1 14:35:44
在CSDN上发现此文,属名"xiaotian",不知是不是这里的版主小田呢?

文章如下:
使用XMLHttp和ADODB.Stream取得远程文件并保存到本地
<%
'****************************************************************************
'PageName:GetRemoteFiles.asp
'Function:Download the files to Server
'Author:xiaotian
'Last Modified at:2003-3-19
'****************************************************************************

'取得远程文件并保存到本地
Function GetRemoteFiels(RemotePath, LocalPath, FileName)
Dim strBody
Dim FilePath

On Error Resume Next

'取得流
strBody = GetBody(RemotePath)
'取得保存的文件名
if Right(LocalPath, 1) <> "\" then LocalPath = LocalPath & "\"
FilePath = LocalPath & GetFileName(RemotePath, FileName)
'保存文件
if SaveToFile(strBody, FilePath) = true and err.Number = 0 then
GetRemoteFiles = true
else
GetRemoteFiles = false
end if

End Function

'远程获取内容
Function GetBody(url)
Dim Retrieval
'建立XMLHTTP对象
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function

'重组文件名
Function GetFileName(RemotePath, FileName)
Dim arrTmp
Dim strFileExt
arrTmp = Split(RemotePath, ".")
strFileExt = arrTmp(UBound(arrTmp))
GetFileName = FileName & "." & strFileExt
End Function

'将流内容保存为文件
Function SaveToFile(Stream, FilePath)
Dim objStream

On Error Resume Next

'建立ADODB.Stream对象,必须要ADO 2.5以上版本
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 '以二进制模式打开
objStream.Open
objstream.write Stream
objstream.SaveToFile FilePath, 2
objstream.Close()
'关闭对象,释放资源
Set objstream = Nothing

if err.Number <> 0 then
SaveToFile = false
else
SaveToFile = true
end if
End Function
%>



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:710
注册:2001/10/24 18:34:42
#22003/8/5 12:30:30
没错正是我,怎么?



布鲁斯狼

职务:普通成员
等级:2
金币:11.0
发贴:377
注册:2003/8/5 10:27:27
#32003/8/5 14:15:08
夸你啊
亏你还斑竹!:)
不过估计是有问题要问!



junner

职务:普通成员
等级:1
金币:0.0
发贴:5
注册:2003/5/7 9:33:02
#42003/8/6 10:58:57
哈哈,被你猜到了,确实有问题要请教版主。

我试了你上面的程序,解决了我的大难题。非常感谢!!
只是当下载文件有 100 M 或更大时非常消耗资源,以至于根本没法下载,不知这个问题能否解决呢?



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:710
注册:2001/10/24 18:34:42
#52003/8/6 14:18:43
首先要注意的是,该方法解决的问题!是针对图片的下载来的,他的定位就是小文件,不要妄想用它下载大的文件



junner

职务:普通成员
等级:1
金币:0.0
发贴:5
注册:2003/5/7 9:33:02
#62003/8/6 15:21:17
我看到一个"iFileDownLoad 3.0 "下载组件
详细资料在这里:http://www.dbstep.com/Products/CView.asp?wj=iFileDownLoad.zip
他实现的方法和小田的方法不知是不是一样的.麻烦小田看一下.谢谢!



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:710
注册:2001/10/24 18:34:42
#72003/8/7 15:41:50
他也没说用什么原理的,但是他也注明了是下载“图片文件,文本文件,HTML文件或Word文件等”,原理可能类似的了



junner

职务:普通成员
等级:1
金币:0.0
发贴:5
注册:2003/5/7 9:33:02
#82003/8/7 17:48:18
我刚找到了他,他说是用DELPHI做的下载组件。
听说DELPHI编的程序可以破解,正在想办法反编译那个DLL。