Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Return

Save files with WeWeb Storage

Set up WeWeb Storage so users can upload files and you can save the file path for later use.

TEMPLATE AVAILABLE

If you wish to skip the manual setup, there is a workflow template available called Upload a File or Get Signed Download URL. You can find it in the WeWeb Storage templates available when creating an API endpoint.

Steps at a glance ​

  1. Enable WeWeb Storage in Data & API.
  2. Create an upload API from the WeWeb Storage template.
  3. Call that API from the Interface.
  4. Save the returned file path on the related record.

1) Enable WeWeb Storage ​

  1. Go to the Data & API tab, then open the Storage subtab.
  2. Select WeWeb Storage. WeWeb sets it up right away.
  3. If your project doesn't have a backend yet, WeWeb first asks where to host it: choose a Location, then click Continue.
The Storage subtab of Data & API with the Connect your storage screen and WeWeb Storage at the top

2) Create an upload API ​

  1. Go to the Data & API tab, then open the Backend Workflows subtab and go to API Endpoints.
  2. Click Add, then choose Files and Media, WeWeb Storage and Upload a File. Click Continue twice to create the endpoint.
The API Endpoints of Backend Workflows with the WeWeb Storage templates: Upload a File, Upload Multiple Files and Get Signed Download URL
  1. In the Upload file action, set Access Level to Public or Private.
  2. Change its Path to choose where the file is saved, for example uploads/ or users/avatars/ followed by the file name. By default, the file is saved under its own name.
  3. Click Auth at the top of the endpoint to review who can upload. By default, any signed-in user can.
The Upload a File endpoint with its Upload file action selected, showing the Access Level, Path and File fields and the Auth button

3) Upload from the interface ​

  1. In the Interface, add a File upload element from the Add panel.
  2. Add a button such as Upload file.
A page with a File upload element and an Upload file button above it
  1. In the button's Workflows tab, create an On click workflow and add your upload API endpoint (From Data & API, then API).
  2. Set the endpoint's file input to the value of the File upload element.
An On click workflow calling the Upload a File API endpoint, with its file input set to File upload - value

When the workflow runs, the API returns the uploaded file details.

4) Save the file reference ​

After the upload succeeds, save the returned file information on the related record.

Recommended rule:

  • Always save the file path
  • Only save the url when the file is public

Examples:

  • Save a profile photo path on the user record
  • Save a contract path on the contract record
  • Save a resume path on the application record

Common pitfalls ​

The file uploads but you cannot find it later ​

  • Save the returned path in your data right after the upload.
  • Do not rely only on the upload response shown during testing.

You do not see the file in Storage ​

  • Make sure you are viewing the same environment where the file was uploaded.

Private files do not open directly ​

  • Create a signed download URL API and use that signed URL instead of trying to use a public link.