Forum Academy Marketplace Showcase Pricing Features

Delete images from database


Even though there are many threads on this topic already, I was not really able to find a solution to my problem.

I have a database of users where I store various data about them, including profile pictures, and images of their IDs to verify them. A couple of days ago bubble notified me that my storage is 60% full. I tried to delete the files with the following method, but it did not seem to work, since my occupied storage has not shrunk since that.

My database looks like this:

I have three problems to tackle:

1 create a workflow that deletes all the remaining ID pictures from my file storage, for all users, possibly not one by one.

2 check if there are any orphan files left in the database and delete them as well.

3 create a permanent logic that removes the ID pictures after the verification has been made.

Currently, I am using the following workflow to delete the ID pictures from the database

I would be really grateful if you could help me with this since I am quite new at using Bubble.

Thanks a lot

Hi there @benedek.wolf,

Welcome to the bubble community!

Your WF should reference the image URL. So in your case, Current Users’s Image_Diak_oldal1’s file URL.

Hope this helps! :blush:

You can watch these two tutorials that go into detail on how to during the upload of images make sure you do not have orphaned or ghost files in your file manager.

In terms of your current problem, being that there are likely a lot of orphaned files eating up your storage capacity, that is going to be difficult. Bubble has not provided us some much much needed functionality in the file manager to make things easier for us to maintain it or rather resolve for issues.

One of those needed and should be extremely easy features would be to allow us to download a CSV file of the URLs in the file manager so that we could then upload it to our database to run some backend workflows to systematically check our database for which files are currently in use and which ones are orphaned so we could delete them.

I do not know if you can access your AWS file storage through Amazon and whether or not there you can export a list of all the file URLs.

At present Bubble has not added any feature to let us easily determine if a file in the file manager is in use (ie: it is saved in the database). The file manager also doesn’t give us any kind of information to easily discern that either.

File manager needs a much needed overhaul, but I don’t envision that being a priority at the moment, so it is best to just keep on top of mind the need to setup your app to manage things effectively from the moment a user uploads a file or image, changes a data field that is a file or image and deletes those files or images. The tutorials linked cover how to do that during the upload process.

1 Like

Hi, thanks for the replies.

I created an API workflow to remove the images from the existing database records and it should be working correctly. However, when I check in my logs how much of my storage is occupied I still see the same amount. Is that a problem from my side (that the workflow is not working) or does bubble not upgrade these metrics instantly (i had done it more than a day ago and it still shows the same)?

1 Like