Saving Files to Bubble
Once your user has uploaded their files, you likely want to save it to your Bubble, or external, database.
You can approach this in two ways. Either use the simpler list states that return just one data point (see Exposed States) or use the more detailed 'Array of Files' state.
Saving from one of the list states
The simpler of the two. To save the file data you just need to run a basic workflow that saves the data to your database.
Create a backend workflow
Create a backend workflow that saves the image to the database. This is the workflow that you will schedule with the 'Schedule API workflow on a list' action.
Create the trigger workflow
Using either one of the existing events (see Events) or a trigger from your own button/existing workflow, add a workflow action that reads the 'List of X' state and passes each item to the API workflow defined in step 1.
Saving from 'Array of files'
While the 'Array of Files' state does provide you with more information to save from, it requires an additional plugin and a backend workflow to work.
While I don't officially recommend or endorse a particular JSON manipulator plugin, the below example was implemented with JSON Manipulator by Opground.
Create a backend workflow
Create a backend workflow that saves a single file to the database. This is the workflow that you will schedule with the 'Schedule API workflow on a list' action.
Create the trigger workflow
Using either one of the existing events (see Events) or a trigger from your own button/existing workflow, add a workflow action that reads the 'Array of Files' state and passes each item to the API workflow defined in step 1.
Last updated