Upload / Download Files from S3

Files can be uploaded to Amazon S3 using the S3 plugin and FilePicker Widget. This document presumes you have successfully connected to your S3 instance

Uploading a File

To upload a file

  1. Drag a Filepicker widget onto the canvas

  2. Create a new S3 query named upload_file to be run onFileSelected

  1. Select the Create File Action option for the query.

  2. The action should be configured with the bucket name and relative path of the location you want to store the file. ex. images/any intermediate folders not existing will be automatically created.

  3. The name of the file should be configured in the file path field. This value can be picked from the Filepicker using javascriptimages/{{ Filepicker1.files[0].name }}

  4. The content can be configured using the raw property of the Filepicker. {{Filepicker1.files[0].raw}}

  5. Select a file from the file picker and hit upload

Click to expand

Downloading Files

To download a file

  1. Drag a Table onto the canvas and name it S3_Files

  2. Create a new S3 query named fetch_files to fetch all the files in your bucket

  3. Configure the List Files action for the query

  4. Set the bucket name from where to fetch the files and run the query

  5. Bind the response of the query to the Table using javascript in the Table Data Property {{fetch_files.data}}

  6. Add a row action to the table named Download

  7. Create a new S3 query for the row action named fetch_file

  8. Configure the fetch_file query with the Read File action.

  9. Configure the bucket name in the query

  10. Pass the file path selected in the table to the query using javascript {{S3_Files.selectedRow.file}}

  11. Configure the onSuccess of the Row Action in the Table to download the file.

  12. Configure the download function with

    1. Data to Download: {{fetch_file.data}}

    2. File name with extension:{{S3_Files.selectedRow.fileName.split('/').pop()}}

  13. Click the download button to download any file in your S3 bucket