Save Uploaded Files to a File Thing in app database

Hi Gurus,

I am using the File Upload widget and I cannot for the life of me work out how to get those files into the app DB and be displayed - there is very little instruction on this in the tutorial. Obviously something basic and hopefully someone here can assist.

Here’s how files (images included) work on Bubble:

When you upload something via the uploader, the file is automatically stored in your app’s file storage. Bubble then generates a URL address to the stored file and lets you store that URL in a Database thing.

Files aren’t stored by themselves on the Database. They are stored in the file storage as I mentioned above and you can store the URL in a Database thing under a field of type ‘file’ or ‘image’. What you’re storing here is simply a reference to the image that’s already uploaded.

So, to upload a file and attach it to a User for example, you can first create a field on the User data type (let’s call it UserFile) and assign it type File.
Now to execute this, run a workflow that makes changes to the User and sets the User’s UserFile value as ‘FileUploader’s value’.

That will work


OK thanks, so then to display the uploaded files, the repeating group will need to be of type User and no File? and the data source will need to be something like CurrentUsersUserFile ?

You can go with either.
If the file is on a field under User, you can do it both ways

  1. RG data type is User:
    RG Data source is do a search for User
    File source will be : current Cell's User's File

  2. RG data type is File
    RG Data source is do a search for User :each item's File
    File source will be: current cell's File

I’d use the type User in case I want to display some other User info along with the image in the RG. Else File makes sense