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.