I’m concious that files in my ‘File Manager’ are taking up lots of space, and I can’t find a way to safely purge it i.e. only delete Files that aren’t in use.
It appears that the File Manager behaves differently depending on how the file is uploaded…
If I upload an ‘Image’ used in page design (e.g. a background image), it appears in the File Manager. If I delete the File (Image) from the File Manager, that I uploaded into a UI element (Static Image), it still appears in the UI element. I have used multiple devices/cleared caches to make sure it wasn’t appearing because it was cached.
I manually created a ‘Thing’ (simulating my upload function) that has a file field, and uploaded a PDF file (as a test). The PDF appears in the File Manager. If I delete the PDF from the File Manager, I can no longer view it from the ‘Thing’, although the File field isn’t updated to say “(Deleted)”. If I do the reverse, and remove the file from the ‘Thing’, it isn’t deleted from the File Manager.
Can anyone confirm how File Manager works, and if there is a safe way to be keeping this clean?
This is not related just to filemanager. But a file is an url in DB. So when you “remove” value from image or file field (or text field), you remove the url, not the file itself. But when you delete a file, this doesn’t remove the url from your DB. Filemanager are mostly a link to file in Bubble storage. Deleting the file in file manager doesn’t change anything in your DB. Same if you use “Delete a file” action. This delete the file, but not the reference (url) to this file in your DB. So when you store a file in a thing, you just store the url. You need to A) Remove the url in DB B) Delete the file.
A database is a table, like an excel sheet or a CSV file. It’s meant to store basic data and map relationships between the data. For example, you can have a User table with several fields (columns). An entry is a row. In your case, the image field is a name of your column. The actual file isn’t stored here in this table. It’s actually stored somewhere in a server (your File Storage). We will simply store the URL (the literal location of your file) of the image here.
If you delete the value stored in the image column of a certain entry (or row), you’re just deleting the URL you stored in your table. You didn’t actually delete the file saved in the server.
To delete the file, you need to call the database and say “hey, delete this file for me”.
This concept is the same across the internet, and not just a bubble thing. Some web builders might obfuscate this process, but Bubble doesn’t. This let’s us control things but adds more complexity.