multipart

Lets consider following code for HTTP task:

{% json upload_options %}
  {
    "fileName": "user_provided_photo.png",
    "multipart": {{request.files.["user-file"] | default: "" | json }},
    "public": false
  }
{% endjson %}

{% assign file_result = upload_options | file %}

{% json ftp_params %}
  {
    "mode": "upload",
    "host": "datajet-app.com",
    "user": "user@datajet-app.com"",
    "password": "pass123",
    "file": {{file_result.fileName | json }},
    "fileName": "ftp_file.png",
    "path": "/",
    "port": 21
  }
{% endjson %}
{% assign ftp_result = ftp_params | ftp %}

In above code we define some upload_options. Parameters are:

  • fileName - under this name your file will be saved in the storage

  • multipart - this parameter tells that the expected file source is multipart. For files with url source it would be replaced with url and for content files with content.

  • public - optional parameter. When set to true your result object will contain an url to your file. With this url everyone can access your upload.

Our file_result will contain fileName parameter (if upload is successful). This is next used in ftp filter options to specify file in your storage and upload it to an FTP.

Last updated