VB example Delphi example Visual C++ ATL example C# example VB.NET example
There are two ways to receive one or more files with the Xceed FTP Library. The first and simplest way to receive one or more files is to use the XceedQuickFtp control. The second way is to use the XceedFtp control's properties and methods, which allow for more flexibility and interactivity. Both options are explained below.
When using the XceedQuickFtp control, there are no properties to set and no events that are triggered. All you need to do is to call the XceedQuickFtp control's ReceiveFile or ReceiveMultipleFiles methods.
To receive a file from an FTP server, perform the following steps. Put an XceedFtp control on a form, or instantiate it dynamically, then:
Specify the FTP server address to connect to. To do this, set the ServerAddress property.
Specify the username to login. Use the UserName property, which is 'Anynomous' by default.
Specify the username's password. Use the Password property, which is 'guest' by default.
Connect to the specified host. To do this, call the Connect method.
Once you are connected you can start receiving files. Call the ReceiveFile to receive a single file, or call the ReceiveMultipleFiles method to receive multiple files using wildcards.
Disconnect from the FTP server. Do this by calling the Disconnect method.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed FTP Library supports standard COM error handling functionality.
Does the file being received already exist? If yes, or if you aren't sure, see the ReplacingFile event so that your application can decide what to do when this happens.
Do you want the file to have a different filename on the local system than what it has on the FTP server? If yes, see the ReceivingFile event and change the sLocalFilename parameter.
Is the FTP server listening on a port other than the usual TCP/IP port 21? If yes, then set the ServerPort property.
The FTP protocol supports "Accounts". Does your FTP server require you to specify an account? If yes, then set the AccountName property or write a handler for the AccountRequired event.