ftp_upload
Uploads file from ftp. Must be used inside {% ftp_session %}
{% endftp_session %}
.
Accepts:
to
- path (including filename) to the directory on remote ftp where the file will be uploaded.content
- content of the file that will be uploadedfile
- name of the file stored in DataJet storage.
to
paramter is required. You can either include content
or file
paramters for file upload
Result is saved in a variable that follows as keyword.
Result has following format:
{
"ok": true,
"error": null, // null only when ok: true
"file": {
"name": "test.csv"
}
}
Below code will upload a file using content paramter:
{% assign host = "ftp.com" %}
{% assign user = "[email protected]" %}
{% assign pass = "password123" %}
{% assign port = 21 %}
{% capture file_content %}
id,quantity
111,0
222,10
333,15
{% endcapture %}
{% ftp_session host:host, user:user, password:pass, port:port, sftp:false %}
{% ftp_upload to:"/incoming/example.csv", content:file_content as upload_result %}
{% log upload_result %}
{% endftp_session %}
Last updated