Skip to main content

Upload Files to S3

This page shows you how to use the Filepicker widget to upload file data to S3.

Prerequisites

Configure query

Configure the S3 query to upload file data, using the following parameters:

Configure S3 query
Configure S3 query
  1. In the Commands dropdown, select the appropriate command:

    • For single-file uploads, select Create a new file.
    • For multi-file uploads, select Create multiple new files.
  2. Add the S3 bucket name to the Bucket Name field.

  3. Specify the file path in the File Path field. For instance, images/any or users/files. You can also use /{{FilePicker1.files[0].name}} to dynamically set the filename. It automatically creates a new folder if the specified folder does not exist.

  4. For multi-file uploads, set the common path in the Common file path field, such as gallery/images.

  5. Select base64 from File data type dropdown.

  6. Define the expiry duration for the signed URL in the Expiry Duration of Signed URL (Minutes) field. The maximum allowed expiration time is one week from the time of creation.

  7. In the Content field, add all the necessary details for uploading to S3, including the information related to the file you want to upload, which should be selected from the Filepicker widget:

// Single-file upload using the "Create a new file" command
{{upload_FilePicker.files[0]}}

// Multi-file upload when using the "Create multiple new files" command
{{upload_FilePicker.files}}

Similarly, if you want to upload an image using the Camera widget, set the OnImageCapture event of the Camera widget to trigger the S3 query and set Content field to:

{
"data": "{{userCamera.imageDataURL}}"
}

Configure Filepicker widget

Follow these steps to configure the Filepicker widget to upload files:

  • Configure the Allowed file types property of the Filepicker widget to allow users to upload files of specific formats.

  • Select Base64 from the Data Format property.

  • Set the Filepicker widget's onFilesSelected event to execute the S3 query.

After completing these steps, select the file(s) and click the Upload File(s) button to send them to the Amazon S3.