Xceed FTP Library Documentation
ReceiveFile method
XceedFtp control reference > Methods > ReceiveFile method

Description

Receive a file from the FTP server.

The remote file to receive must be specified in the sRemoteFilename parameter. You can specify a filename without a path, or you can specify a path relative to the FTP server’s current working folder , or you can specify an absolute path on the remote system. If you specify a filename without a path, the filename specified will be received from the FTP server’s current working folder.

You can start receiving a file’s data from a specific offset specified by the lRemoteOffset parameter. Specify 0 for this parameter if you want to receive the entire remote file.

The sLocalFilename parameter requires you to specify a valid path and filename on your local system for the file to receive.

This method can only be used when the CurrentState property's value is fcsConnected.

Parameters
 

Parameter Description
sRemoteFilename  The remote filename of the file to receive.
lRemoteOffset  The byte offset of the remote file to start receiving data from.
sLocalFilename  The path and filename for the file to receive.

Remarks

Although you can select the path and filename of the file to receive by specifying the desired path and filename via the sLocalFilename parameter, writing an event handler for the ReceivingFile event will allow you to modify the incoming file's filename and path right before the file is actually transferred.

Declaration  
HRESULT ReceiveFile
(
[in] BSTR sRemoteFilename,
[in] long lRemoteOffset,
[in] BSTR sLocalFilename
)

Applicable properties

AccountName, LocalDataAddress, LocalDataPort, PassiveMode, RemoteDataAddress, RemoteDataPort, RepresentationType

Events triggered

FileTransferStatus, LoggingCommandLine, ProcessCompleted, ReceivingFile, ReplacingFile