Downloading a file via FTP is as simple as using the wwFTP class and calling the FTPGetFile method of the class. The class supports wildcard filenames so you can download more than one file in a single pass.

o=create("wwFTP")
IF o.FTPGetFile("ftp.west-wind.com","wwxml.zip","c:\temp\wwxml.zip") # 0
   ? o.cErrorMsg
ENDIF

** Or you can use object syntax:
o.cFTPServer="ftp.west-wind.com"
o.cFTPSource="/wwxml.zip"
o.cFTPTarget="c:\temp\wwxml.zip"
IF o.FTPGetFile() # 0
   ? o.cErrorMsg
ENDIF


The above method is the easiest to use, but it connects and disconnects for each file. If you need to download more than one file, you can use FTPGetFileEx instead:

o=create("wwFTP")

o.FTPConnect("ftp.west-wind.com")
o.FTPGetFileEx("/downloads/pkzip.exe","c:\temp\pkzip.exe")
o.FTPGetFileEx("/downloads/pkunzip.exe","c:\temp\pkunzip.exe")
o.FTPClose()

This is more efficient as no reconnecting occurs. The FTPGetFileEx method also supports a message event that you can capture to report download status, which the plain FTPGetFile does not support.


Last Updated: 7/7/1999 | Send topic feedback