To FTP
- Lianne So
- Aryn Wiebe
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 https://interfaceware.atlassian.net/wiki/x/AYC6sw 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.
Using +COMPONENT, import the To FTP component. Since it is a destination component, you will need to https://interfaceware.atlassian.net/wiki/x/yYIBo to link it to a source component that will send it data to write to the FTP server.
Fields marked with an asterisk * are required.
Connection Configurations:
Field | Description | Default Value |
---|
Field | Description | Default Value |
---|---|---|
Protocol * | Specifies the protocol you’ll be using. Supports: FTP, FTPS, or SFTP |
|
Server * | The server you will be connecting with | - |
Port * | The port to use | - |
Username * | The remote user to login as. This account will need permissions to read, delete, and/or move files to the specified FTPDirectory | - |
Password | The password to authenticate with. | - |
Certificate | 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 FTP and FTPS. | - |
PrivateKey | 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. | - |
RetryCount | The number of times to retry the connection if it drops. Default is set to 3 attempts. |
|
FTP Workflow Configurations:
Field | Description | Default Value |
---|
Field | Description | Default Value |
---|---|---|
FTPDirectory * | The target directory on the FTP server you’ll be writing files to | - |
OutputFileMask * | 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) |
|
OneFilePerMessage | Specifies whether each inbound message will have its own file. If set to false, the file will only be uploaded to the FTP server once the component rolls over to the next file. |
|
OutputEncoding * | The encoding used in the output file. If left blank, encoding will be updated to the default according to OS. See Supported File Encodings |
|
Escape8BitCharacters | 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). |
|
UseRemoteTempFiles
| Specifies whether to use temporary files while uploading to the FTP server. When true, it will append “.tmp” to files currently being written until the component is done writing to them. It will only remove the .tmp extension when a new file is written in. |
|
OverwriteFTP | Specifies whether files on the FTP server will be overwritten. |
|
Local File Workflow Configurations:
Field | Description | Default Value |
---|
Field | Description | Default Value |
---|---|---|
DestinationDirectory * | The local directory that the files will be written to from the component before uploading to the server. | - |
UseTempFiles | 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. It will only remove the .tmp extension when a new file is written in. |
|
KeepLocalFiles | Specifies whether to keep local files or delete them once the files have been uploaded to 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:
By default, the FTP/FTPS/SFTP connection is authenticated using username and password authentication and uses the default configurations. In some cases, additional configurations may be desired, such as:
Specifying a FTP(S) mode
Using 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 Input parameter table in FTP/FTPprocess.lua: