Skip to main content

To FTP

The To FTP component connects to a FTP, FTPS, or SFTP server and uploads files to the server. It receives data from an upstream component, writes the data to a local target directory in the same way the To File writes files, and then uploads the files to a FTP, FTPS, or SFTP server.

Running the Component

The below steps assume an existing FTP/FTPS/SFTP server is available to connect to and the necessary user permissions and folder structure are in place on the FTP server and locally.

STEP 1: Import the To FTP component

Using +COMPONENT, import the To FTP component. Since it is a destination component, you will need to Edit Connections to link it to a source component that will send it data to write to the FTP server.

STEP 2: Set up the component configurations

Bolded fields are required, otherwise default values defined in config.json are used:

File Configurations:

Field

Description

Default Value

Local Destination Directory

The local directory that the files will be written to from the component before uploading to the server.

Output File Name Format

The name and extension of the output files (local and on the FTP server).

%Y (year), %m (month), %d (day), %H (hour), %M (minute), %S (second) and %f (millisecond), %i (unique ID YYYYMMDDhhmmss_XXXXX - separate files configuration only)

output_%Y_%m_%d_%H_%M_%S.txt

Write Each Message To

Specifies whether each inbound message will have its own file or be appended to a batch file. The batch file will only be uploaded to the FTP server once the component rolls over to the next file depending on the smallest file mask.

Separate files

Escape 8-Bit Characters

Specifies whether to escape non-ASCII characters in outbound messages.

Ex. "é" would be sent as "\XE9" (in Latin-1 or Windows-1252) or "\XC3\XA9" (in UTF-8).

false

Use Local Temporary Files

Separate files configuration only - specifies whether to use temporary files while writing.

When true, it will append ".tmp" to files currently being written until the component is done writing to them.

true

Output File Encoding

The encoding used in the output file. List of available encodings is available when you click to change the encoding.

Use system default ISO-8859-1 on Linux/MacOS or Windows-1252 on Windows

FTP Workflow Configurations

Field

Description

Default Value

FTP Protocol

Specifies the protocol you'll be using. Supports: FTP, FTPS, or SFTP

FTP

FTP Server

The server you will be connecting with.

FTP Port

The port to use.

FTP Username

The remote user to login as.

This account will need permissions to read, delete, and/or move files to the specified Remote Destination Directory.

FTP Password

The password to authenticate with.

Private Key File

The name of your private key file, if in use.

By default, this should be a PEM certificate and not be password-locked. The default configurations can be changed by modifying the net.[protocol].init function directly in the script. See Adapting the Component.

This configuration is only applicable for SFTP and FTPS.

Certificate File

The name of your certificate file, if in use.

By default, this should be a PEM certificate. The default configurations can be changed by modifying the net.[protocol].init function directly in the script. See Adapting the Component.

This configuration is only applicable for FTPS.

Public Key File

The name of your public key file, if in use.

By default, this should be a PEM certificate and not be password-locked. The default configurations can be changed by modifying the net.[protocol].init function directly in the script. See Adapting the Component.

This configuration is only applicable for SFTP.

Remote Destination Directory

The target directory on the FTP server you'll be writing files to.

Use Remote Temporary Files

Specifies whether to use temporary files while uploading to the FTP server.

When true, it will append ".tmp" to FTP uploaded files until the component is done writing to them.

true

Connection Retry Count

The number of times to retry the connection if it drops.

60

Retry Pause (s)

The interval of time in seconds the component will wait between retries. Default is set to 10 seconds.

10

Post-processing Configurations:

Field

Description

Default Value

After Upload

Specifies whether to keep local files or delete them once the files have been uploaded to the FTP server.

Keep local files

Processed Files Directory*

The local directory that the uploaded/processed files will be moved to.

*Only required ifAfter Uploadconfiguration is set toKeep local files.

FTP Overwrite Handling

Specifies what the behaviour of the component should be when finding an already existing file with the same name on the FTP server (i.e., collisions).

Options are: Stop component, Overwrite remote file, Skip file

Stop component

Enable Debug Logs

Enable/disable logging of additional debug information.

false

STEP 3: Start the component and view the processed files on the FTP server

Once the component has been started, it will receive data from the connected source component. It will write the data to files in the specified local directory. It will then upload the written files to the target FTP server. Access the FTP server to see the uploaded files and verify that the contents are being written as expected.

Adapting the Component

There are a few ways you can adapt and expand this component for more complex workflows:

Customize the FTP/FTPS/SFTP connection

By default, the FTP/FTPS/SFTP connection is authenticated using username and password authentication or via keys and uses the default configurations. In some cases, additional configurations may be desired, such as:

  • Specifying a FTP(S) mode

  • Modifying public and private key authentication

  • Disabling verify_peer or verify_host

  • Increasing the timeout

  • and more. Full details can be found by accessing the net.ftp.init, net.ftps.init, or net.sftp.init function help in the Translator

These configurations can be customized by modifying the desired ConnectionParameters table in the FTPconnector folder, each protocol has its own parameter table so you can modify FTP's parameters without affecting the others: