# Saving Files to Bubble

Once your user has uploaded their files, you likely want to save it to your Bubble, or external, database.&#x20;

You can approach this in two ways. Either use the simpler list states that return just one data point (see [Exposed States](/ultimate-uploadcare/elements/ultimate-uploadcare-uploader/exposed-states.md)) or use the more detailed 'Array of Files' state.&#x20;

## 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.

{% stepper %}
{% step %}

### 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.

<img src="/files/W5AmZX4wZPi8Ue5rs2HI" alt="" data-size="original"><img src="/files/vmdfhPaPEpwjJKomKqAE" alt="" data-size="original">

{% embed url="<https://bubble.io/page?id=dragdropdevelop&name=ultimate-uploadcare&tab=Workflow&type=api&wf_item=bTILD>" %}
Workflow editor
{% endembed %}

{% endstep %}

{% step %}

### Create the trigger workflow

Using either one of the existing events (see [Events](/ultimate-uploadcare/elements/ultimate-uploadcare-uploader/events.md)) 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.

![](/files/NqilM1HoAIAwczeXezC2)![](/files/iVyDlsr5AAQLw9kZhNy3)
{% endstep %}
{% endstepper %}

## 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](https://bubble.io/plugin/json-manipulator-1629969174278x365092981307605000) by Opground.

{% stepper %}
{% step %}

### 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.

<img src="/files/o1G86c4OS11b2y5bL5tZ" alt="" data-size="original"><img src="/files/M98xjVoxospJzfGpXiAX" alt="" data-size="original">

<img src="/files/fW1BVR9wa1tlgDr7W2bL" alt="" data-size="original"><img src="/files/7DhmEoyujaIeWCWaLubY" alt="" data-size="original">

<img src="/files/dntB1bgGzxZuPuyJZeyV" alt="" data-size="original">

{% embed url="<https://bubble.io/page?id=dragdropdevelop&name=ultimate-uploadcare&tab=Workflow&type=api&wf_item=bTIKZ>" %}
Workflow editor
{% endembed %}
{% endstep %}

{% step %}

### Create the trigger workflow

Using either one of the existing events (see [Events](/ultimate-uploadcare/elements/ultimate-uploadcare-uploader/events.md)) 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.

<img src="/files/YiwN319xY9JBA5ayoIOw" alt="" data-size="original">

<img src="/files/h4mpA9wQwVppqAno7eX5" alt="" data-size="original">
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jake-bennett-tech.gitbook.io/ultimate-uploadcare/implementation/saving-files-to-bubble.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
