File upload step

The file upload step asks a user to upload the file(s) which can be later accessed via the reporting in the Control Room and in the bot variables.

The current maximum file size is 25 MB

Here’s the demo for this step type:

You can add it via the standard new step menu:

It has the following important settings

Number of answers a user can give

Sets the limit of the number of files to upload

Accepted file types

Limits the file types accepted. You can use extensions (.jpg) or mime types (for example, text/csv).

Allow camera upload

Allows uploading the photos taken directly from the (web)camera of the respondent

Maximum file size in MB

The maximum file size allowed for the upload, in MB. If not specified, it’s set at 25 MB

The file URL is direct

When used in notifications and response actions, the uploaded file URL will be a direct URL instead of the URL to the chat transcript. Please note that this is a security risk if the uploaded files contain sensitive information as the direct URL can be shared, even though the URL is not permanent and will expire. The default file URL expiration is 1 hour.

Customize the file URL expiration

Set a custom file URL (non-public) expiration, in seconds. This can be also used in the case when the direct file URL is not enabled, as it affects the file URL provided in step variables of the response actions.

File URL is public

When used in notifications and response actions, the uploaded file URL will be a direct public URL. Please note that this is a security risk if the uploaded files contain sensitive information as the direct URL can be shared. The file URL is permanent and will never expire.

Answering is required

When not enabled, the file upload will be optional and the user can continue the bot conversation without uploading any file.

Accessing the uploaded files via the bot variables

If you create a bot variable of step type, selecting the file upload step, then:

To access uploaded file names, comma-separated, use syntax:

{{fileUpload}}

To access the uploaded file id, name, and temporary URL, comma-separated, use the syntax:

{{fileUpload.value}}

To access the variable in the script variable:

variables.fileUpload.value

Example result will be:

['fileID1', 'fileName1', 'fileURL1', 'fileID2', 'fileName2', 'fileURL2']

Note that the file URL provided is a temporary secret URL that expires in 1 hour by default and can be customized via the step settings.

If you need to send the uploaded files’ URLs to some external service via JSON webhook, for example, you can use a script variable to format the URLs as a comma-separated string:

function(callback, variables) {
  var value = JSON.parse(variables.file_upload.value)
  value = value && value.filter(function(_, index){return (index+1)%3 === 0}) || []
  callback(value.join(','))
}

Where file_upload is your file upload step’s bot variable name.

Edit this page