The simplest way to upload a file to an FTP server involves using the FTPSendFile method. This method connects to the server, grabs the file and then disconnects. To use this method set a few properties and then call the FTPSendFile method:

	
o.cFTPServer="ftp.west-wind.com"
o.cFTPSource="c:\temp\wwcgierr.txt"
o.cFTPTarget="/uploads/wwcgierr.txt"

*** Use passwords if Anonymous is not allowed.
* o.cUsername="username"      
* o.cPassword="password"

IF o.FTPSendFile()  # 0
   ? o.cErrorMsg
ENDIF

You can also use the lower level method FTPSendFileEx which allows more control over how the file is sent. This method allows for message events to be fired that you can catch and allow you to display status information. For details see the documentation for this method. This method also allows you to send multiple files to be sent without reconnecting for each file. The basic syntax for this method is:

o=create("wwFTP")

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


Last Updated: 8/21/2003 | Send topic feedback