# Outgoing FTP and FTPS connections

Host, port, credentials and FTPS for plain FTP servers, with the same API as SFTP and SMB.

An outgoing FTP connection lets Zato services access an FTP server, using plain FTP or FTPS. Services obtain connections by the name given here.

In Dashboard, go to `Connections → Outgoing → FTP` and click Create.

The fields:

| Name | Notes |
| --- | --- |
| Name | The name of the connection, as used in your services |
| Use SSL (FTPS) | Whether the connection uses FTPS - FTP over TLS |
| Host | The remote server's host |
| Port | The remote server's port, with a default of 21 |
| Username | The username to log in with |
| Password | The password to log in with |
| Store file contents | Whether the [audit log](https://zato.io/docs/admin/audit-log/) keeps the bytes of each transferred file, in addition to the always-recorded metadata |
| Verify stores by | How an upload is confirmed - `Size` compares the size of the remote file with what was sent, `Read back` reads the whole file back and compares its bytes |

## Paths {#paths}

Remote paths are relative to the account's root directory and use forward slashes:

path

```text
documents/invoice.pdf
```

The same goes for the directory a [schedule](https://zato.io/docs/dev/file-transfer/schedules.html) is given.

## What you can do with the connection {#what-you-can-do-with-the-connection}

Once the connection exists, a service reaches it through `self.ftp`:

```python
from zato.server.service import Service

class MyService(Service):

    def handle(self):

        conn = self.ftp['My FTP Connection']

        # The file's contents
        data = conn.read('incoming/orders.csv')
```

[The connection API](https://zato.io/docs/dev/file-transfer/connection-api.html) lists every method and its arguments - reading, writing, uploading, listing, moving and deleting. You can also run commands with [`conn.execute`](https://zato.io/docs/dev/file-transfer/connection-api.html#differences-between-sftp-ftp-and-smb), one per line - `ls`, `stat`, `exists`, `mkdir`, `rmdir`, `rm`, `mv`, `cat` and `ping`, the same ones the FTP command shell in Dashboard offers.

[File transfer schedules](https://zato.io/docs/dev/file-transfer/schedules.html) let Zato monitor a directory on this server.

## Learn more {#learn-more}

- [File transfer](https://zato.io/docs/dev/file-transfer/) - SFTP, FTP and SMB behind one API, driven by your code or by a schedule
- [The connection API](https://zato.io/docs/dev/file-transfer/connection-api.html) - Upload, download, read, write, list and manage remote entries
- [Schedules](https://zato.io/docs/dev/file-transfer/schedules.html) - Have Zato watch a remote directory and invoke a service per file
- [Receiving files](https://zato.io/docs/dev/file-transfer/receiving-files.html) - What the service receives, and the two ways to refuse a file
- [Real-world feeds](https://zato.io/docs/dev/file-transfer/feeds.html) - Marker files, archiving, bad files and pausing a feed
- [File transfer in enmasse](https://zato.io/docs/dev/file-transfer/enmasse.html) - Connections and schedules as YAML, ready for version control
