InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / FileTransfer Object / FTPSendFile Method
Specifies a local file. This string can be empty or can contain just drive and path information, in which case the host filename is used to generate a local filename. This string cannot contain wildcard characters.
Specifies a host file or files to be transferred. This string can contain wildcard characters (to transfer multiple files). The wildcard characters must be appropriate for the host system.

A TransferTypeOption Enumeration value that specifies what type of file is being transferred.

TransferTypeOption_ASCII specifies ASCII file transfer. InfoConnect applies the ASCII File Translation options (as specified on the Translation tab in the File Transfer Setup dialog box) to the data in the file as it is transferred.

TransferTypeOption_Binary specifies binary file transfer. Data in the file is not translated as it is transferred.

TransferTypeOption_AutoDetect determines file transfer type by the file extension. Use these properties to determine which file extensions are linked to which transfer type: TransferAutoDetectDefaultType; TransferAutoDetectASCIIExtensionList; and TransferAutoDetectBinaryExtensionList

A DestinationFileExistsOption value that specifies what to do if the file already exists on the host. The possible values are:

DestinationFileExistsOption.AskUser prompts the user to specify what should be done.

DestinationFileExistsOption.Cancel stops the transfer.

DestinationFileExistsOption.Update performs the transfer only if the host file is newer than the PC file.

DestinationFileExistsOption.Delete deletes (overwrites) the existing file.

DestinationFileExistsOption.Append appends the contents of the host file to the existing PC file.

DestinationFileExistsOption.Rename renames the file being transferred. The existing file retains the original name. The last three characters of the file being transferred are changed to 001. If such a file already exists, the filename is changed to 002, and so on up to 999.

DestinationFileExistsOption.Skip skips the file (the transfer does not take place, but no error results).

Specifies a date and time. Host files created or modified before the specified date and time are transferred.
Specifies a date and time. Host files created or modified after the specified date and time are transferred.
Specifies one or more files to be excluded from a wildcard transfer. The filenames can include wildcards.
Example
In This Topic
    FTPSendFile Method
    In This Topic
    Transfers one or more files from the PC to the host using FTP file transfer protocol. Use FTPStartServer to connect to the host server before using this method. Use FTPStopServer to disconnect from the host server after file transfer is complete.
    Syntax
    expression.FTPSendFile( _
       ByVal localFile As String, _
       ByVal remoteFile As String, _
       ByVal transferType As TransferTypeOption, _
       ByVal fileExists As DestinationFileExistsOption, _
       ByVal before As Date, _
       ByVal since As Date, _
       ByVal exclude As String _
    ) As ReturnCode
    where expression is a variable that represents a FileTransfer Object

    Parameters

    localFile
    Specifies a local file. This string can be empty or can contain just drive and path information, in which case the host filename is used to generate a local filename. This string cannot contain wildcard characters.
    remoteFile
    Specifies a host file or files to be transferred. This string can contain wildcard characters (to transfer multiple files). The wildcard characters must be appropriate for the host system.
    transferType

    A TransferTypeOption Enumeration value that specifies what type of file is being transferred.

    TransferTypeOption_ASCII specifies ASCII file transfer. InfoConnect applies the ASCII File Translation options (as specified on the Translation tab in the File Transfer Setup dialog box) to the data in the file as it is transferred.

    TransferTypeOption_Binary specifies binary file transfer. Data in the file is not translated as it is transferred.

    TransferTypeOption_AutoDetect determines file transfer type by the file extension. Use these properties to determine which file extensions are linked to which transfer type: TransferAutoDetectDefaultType; TransferAutoDetectASCIIExtensionList; and TransferAutoDetectBinaryExtensionList

    fileExists

    A DestinationFileExistsOption value that specifies what to do if the file already exists on the host. The possible values are:

    DestinationFileExistsOption.AskUser prompts the user to specify what should be done.

    DestinationFileExistsOption.Cancel stops the transfer.

    DestinationFileExistsOption.Update performs the transfer only if the host file is newer than the PC file.

    DestinationFileExistsOption.Delete deletes (overwrites) the existing file.

    DestinationFileExistsOption.Append appends the contents of the host file to the existing PC file.

    DestinationFileExistsOption.Rename renames the file being transferred. The existing file retains the original name. The last three characters of the file being transferred are changed to 001. If such a file already exists, the filename is changed to 002, and so on up to 999.

    DestinationFileExistsOption.Skip skips the file (the transfer does not take place, but no error results).

    before
    Specifies a date and time. Host files created or modified before the specified date and time are transferred.
    since
    Specifies a date and time. Host files created or modified after the specified date and time are transferred.
    exclude
    Specifies one or more files to be excluded from a wildcard transfer. The filenames can include wildcards.

    Return Value

    One of the following ReturnCode enumerated values.

    Member Description
    Cancelled Cancelled.
    Error Error.
    PermissionRequired Permission is required.
    Success Success.
    Timeout Timeout condition.
    Truncated The text is truncated.

    Example
    'This example transfers a local file to an FTP server.
    Sub SendFileExample()
     
        On Error GoTo Handler
     
        Dim rcode As ReturnCode
        
        'Set the date as the current time.
        Dim mydate As Date
        
        
        'Connect to the host server, leaving the password empty - you'll need to log on to the session before you run the macro.
        ThisTerminal.FileTransfer.FTPStartServer "your_user_name", "", "your_ftp_server", FTPServerOption_None
        
        'Transfer a local file as an ASCII file to a server and overwrite the file on the server if it exists.
        'Specify to transfer the file regardless of whether it was created or modifed before or after the current time.
        'This file name does not include wildcards so we don't need to exclude any files.
        rcode = ThisTerminal.FileTransfer.FTPSendFile("C:\test\local_file.txt", "remote_file", TransferTypeOption_Ascii, DestinationFileExistsOption_Overwrite, mydate, mydate, "")
        
        'Stop the host server.
        ThisTerminal.FileTransfer.FTPStopServer
        
        Exit Sub
        
    Handler:
        
            MsgBox Err.Description
     
    End Sub
    See Also