SFTP and FTP
SFTP (SSH File Transfer Protocol) and FTP (File Transfer Protocol) are connectors provided by DronaHQ. SFTP ensures secure file transfer using encryption, while FTP is a standard protocol for transferring files between a client and a server on a network.
Prerequisite
Server Authentication: To use the SFTP or FTP connector provided by DronaHQ, you need valid authentication credentials. Choose either of the following options:
- Username and password for FTP authentication.
- SSH key pair for SFTP authentication.
Connection Details:
- Server Hostname or IP address for communication.
- Port number for connecting to the server (21 for FTP, 22 for SFTP).
File Locations: Familiarize yourself with the server's directory structure where you'll be performing file operations.
Connection Mode: Understand whether the connection requires Active or Passive mode, especially for FTP connections.
Configuring Connector in DronaHQ
Configure your database category using the provided details. Validate connection with Test connection
and Save
settings for secure database setup.
Choose from SFTP and FTP, depending on it you will be asked to configure respective required fields.
Protocol Type - SFTP configuration
General
Field | Description |
---|---|
Protocol Type | Select from SFTP and FTP Protocol types |
Host | Enter the Host Domain or IP |
Port | Enter the Port number |
Authentication | Select authentication method between Username and Password and Private key |
Username | Enter the Username |
Password | Enter the Password |
Authentication
field is available for SFTP protocol type.
Admin
Advanced Option | Description |
---|---|
Connection Options | The key and value connection options in database configuration refer to specific settings (keys) and their corresponding values that dictate how the application connects to the database |
SSH Keys | Ensure you have SSH keys available in your DronaHQ account for secure connections. The server you want to connect to must have the DronaHQ-generated public key/SSH Key saved in it. |
Whitelist IP | Enhance security by restricting database access to specific whitelisted IP addresses. |
Adding List Directory Queries to SFTP and FTP Connectors
After successfully configuring the SFTP and FTP connectors, you can utilize the List Directory action to manage your file directories. Here's how you can create and handle list directory queries for these protocols:
Query Definition: Give your query a unique name to easily identify and manage it.
Action Choice: Select the List Directory action from the available options. This action retrieves a list of files and directories within the specified path.
Set Path: Provide the path for the directory you want to list. This could be an absolute path or a relative path from the root directory of the connected server.
Run the Query: Once you've configured the action and parameters, you can execute the query by clicking
Test Query
The response will be displayed based on the provided parameters, allowing you to review the retrieved data or the outcome of the query.
Utilize double curly brackets for incorporating dynamic variables. Prior to saving, test with sample values. Associate dynamic variables with controls/actions for real-time utilization.
Your saved queries will be visible beneath your connector within the Connector Library.
Supported Actions
Action | Description |
---|---|
listdir | List files and directories within a specified path. |
deletefile | Delete a file from the remote directory. |
changemode | Change the permissions (mode) of a file. |
mkdir | Create a new directory in the remote location. |
rmdir | Remove an empty directory from the remote location. |
exists | Check if a file or directory exists in the remote location. |
stats | Retrieve file or directory stats (size, timestamps, etc.). |
rename | Rename a file or directory in the remote location. |
downloadfile | Download a file from the remote location. |
uploadfile | Upload a local file to the remote location. |
Downloading file from the remote location
Let us assume that we have a form where we specify the source path of file. Let us add an action button that triggers the action flow to download file.
On the button_click
event of the action button, add the Server-side action
and choose configured SFTP connector and select query whose action is downloadfile. Turn Download as File toggle on and click on finish.