How do you keep clean your file storage?


When you use Bubble’s native picture uploader, every time a picture is selected, it is saved in your file manager (even if you don’t end up “saving” that image to any data thing). So, for example, if a user is selecting his profile picture and changes 6 times his profile picture before finding the one he likes, those 6 pictures will be now saved in your file manager, although in the end, the user just saved 1.

This multiplied by many users, can result in a bunch of unnecessary files that where never used by your users but are consuming storage capacity in your app and since those files are not attached to any data thing, you can’t delete them programmatically, this means you would have to, periodically:

1st. Manually check the files in your file manager one by one and then investigare to see which of the files in the file manager are NOT being used by any data thing (Very difficult task at large scale and probably at small scale as well).

2nd. Delete those files manually through the file manager.

This sounds crazy and I hope that I am wrong. I just wanted to know how other people avoid their file manager to be filled with unused files. Please let us know if you have any trick for this, or if I am wrong.



There are a few issues related to this problem.

  1. When you upload a file and have not saved it yet, the file is already saved to the file manager. When you save, the URL of the file is populated to the field in the data type. When you edit/upload a file again, a new file is saved to the file manager and the URL of the file is replaced by the new file, but the old file is still in the file manager. The solution is to delete the old file before saving the new one.

  2. When a user uploads a file and have not saved it yet, he uploads 2 more times because he has selected the wrong files. Now the file field has the latest file URL, but the file manager has 3 copies. How do you delete the 1st 2 files that are saved to the file manager? How do we clean up the orphan files?

I hope there are good solutions to these issues.


I have also created an item on the Bubble Ideaboard. Please upvote it if you think it is a good idea. :grin:

2 options to help clean up orphan files

If the link doesn’t work, copy and paste it to your browser instead.

1 Like