Xceed FTP Library Documentation
XceedFtp control reference / Methods / SendFile method
In This Topic
    SendFile method
    In This Topic

    Description

    Send a local file to the FTP server.

    The path and filename of the local file to send must be specified by the sLocalFilename parameter. The filename, or path and filename of the file being sent on the remote server must be specified by the sRemoteFilename parameter. The remote filename can be relative to the FTP server’s current working folder , or can be an absolute path on the remote system.

    You can start sending a local file’s data from a specific offset specified by the lLocalOffset parameter. Specify 0 for this parameter if you want to send the entire local file.

    This method cannot inform you if the remote filename already exists, so therefore the bAppend parameter must be set in order to determine if the file should be appended or overwritten on the remote server if it already exists. Setting bAppend to True will cause the remote file, if it exists, to be appended to. Setting bAppend to False will cause the remote file, if it exists, to be overwritten.

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

    Parameters
     

    Parameter Description
    sLocalFilename  The filename of the local file to send.
    lLocalOffset The byte offset of the local file to start sending data from.
    sRemoteFilename  The name of the file as it should be sent to the FTP server. A path can optionally be specified. If this parameter is left completely empty, the FTP server usually will select a unique filename. If this happens, you can obtain the filename chosen by the FTP server by checking the parameters of the SendingFile event.
    bAppend  Set to True if you want to append to the remote file if it already exists. Set to False if you want to overwrite the remote file if it already exists
     
    Declaration  
    HRESULT SendFile
    (
    [in] BSTR sLocalFilename,
    [in] long lLocalOffset,
    [in] BSTR sRemoteFilename,
    [in] VARIANT_BOOL bAppend
    )

    Applicable properties

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

    Events triggered

    FileTransferStatus, LoggingCommandLine, ProcessCompleted, SendingFile