Upload multiple files

Upload multiple local files to an external API endpoint via HTTP POST/PUT.

Upload multiple local files to an external API endpoint via HTTP POST/PUT.

By default, the files are sent as multipart/form-data, with each file included in its own field. The Binary stream only? property can be used to send the files as a raw binary stream.

If you are only uploading a single file, consider using the Upload file flow instead, which does not wrap the file in form data field, but includes it in the request body directly. This is required by some endpoints, such as AWS S3.

Once the upload has started, the first output triggers, giving you the unique Job ID for the upload.

As the upload progresses, onFileUploadProgress events are sent out. Each event includes the job ID, total bytes sent and total file size, allowing you to track multiple concurrent uploads.

Finally, when the file is uploaded, the onFileUploadCompleted event is triggered, again including the job ID plus final response headers, body and status code from the API endpoint.

If the upload errors, the second output is triggered, and a onFileUploadError event is triggered.

Input arguments

Label

Key

Type

Required?

Default

Description

Source files

files

Array

Yes

Local files to upload.

Target URL

toUrl

String(url)

Yes

Target external URL to upload the files to.

HTTP method

method

String

Yes

POST

HTTP method to use.

Headers

headers

Object

No

Headers to include in the HTTP call.

Form data fields

formDataFields

Object

No

Additional fields to include in the body of the request, in addition to the ones containing the files.

Binary stream only?

binaryStreamOnly

Boolean

No

If true, the files will be uploaded as a raw binary stream instead of the default multipart/form-data.

Output arguments

Number of outputs: 2

Label

Key

Type

Description

Upload job ID

jobId

Number(integer)

Unique job ID for the upload.

Events

Label

Key

Description

Properties

File upload progress

onFileUploadProgress

Triggered when the file upload progresses.

jobId, totalSize, bytesUploaded

File upload completed

onFileUploadCompleted

Triggered when the file upload has been completed.

jobId, statusCode, headers, body

Errors

Label

Code

Description

Unknown error

unknown

Thrown if the upload fails for an unknown reason