ftp_upload

Uploads content or a file to the FTP/SFTP server. Must be used inside an ftp_session block.

{% ftp_session host: "ftp.example.com", user: "myuser", password: "mypass" %}
  {% ftp_upload to: "/uploads/data.csv", content: csv_content as result %}

  {% if result.ok %}
    {% log "Upload successful" %}
  {% endif %}
{% endftp_session %}

Syntax

{% ftp_upload to: "/path/to/destination", content: content_variable as result_variable %}
{% ftp_upload to: "/path/to/destination", file: "filename_in_storage" as result_variable %}

Parameters

Parameter
Required
Description

to

Yes

Destination path on the FTP server

content

Yes*

Raw content to upload

file

Yes*

Name of file in DataJet storage to upload

*Either content or file is required, but not both.

Result Object

Property
Type
Description

ok

boolean

true if upload succeeded

error

string/null

Error message if ok is false, null on success

file.name

string

Name of the uploaded file

Example result:

Examples

Upload text content:

Upload JSON data:

Upload file from DataJet storage:

Upload to nested directory (auto-created):

Notes

  • Must be used inside an ftp_session block

  • Consumes 2 credits per upload

  • Directories in the destination path are created automatically if they don't exist

  • Use content for raw text/data, use file for files already in DataJet storage

  • Maximum content size depends on your plan limits

Last updated