# Picture Uploader/File Manager Dilemma

**URL:** <https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748>\
**Category:** Database\
**Created:** [June 4, 2022, 9:05pm UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748 "2022-06-04T21:05:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sydney22](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@sydney22](https://forum.bubble.io/u/sydney22)\
**Post date:** [June 4, 2022, 9:05pm UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/1 "2022-06-04T21:05:59Z")

</div>

I allow users to upload photos for two different use cases: profile pictures and photos that get posted to social media. The profile pictures are stored as an image field in a data type but the latter category are so-called “orphaned” photos (i.e., not tied to a data type or saved in the database).

I want to purge File Manager of this second category every 24 hours without deleting profile photos or my own app’s image assets (that had to be uploaded via a picture uploader and thus end up in File Manager). How can I do this without going through and deleting images one by one?

---

<div class="post-metadata">

**Author:** ![jobs](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jobs](https://forum.bubble.io/u/jobs)\
**Post date:** [June 4, 2022, 11:45pm UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/2 "2022-06-04T23:45:18Z")

</div>

To me it sounds like you’d like to delete every photo every 24 hours. (Except for profile pictures.)

My approach would be to make a repeating group somewhere in your app, which would do a search for the pictures not tied to a user profile picture.

Once you’ve got the “Do A Search For” correct, you have the pictures you want to delete.

You can now take that “Do A Search For” Logic, and put it on the backend api, that deletes those pictures, and schedules itself to run again in 24 hours.

Hope that makes sense. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [June 4, 2022, 11:48pm UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/3 "2022-06-04T23:48:52Z")

</div>

A daily ran, recursive workflow may be what you need here however, it may be easier. If you go 🦄 , you’ll need a new method.

---

<div class="post-metadata">

**Author:** ![sydney22](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@sydney22](https://forum.bubble.io/u/sydney22)\
**Post date:** [June 5, 2022, 12:41am UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/4 "2022-06-05T00:41:08Z")

</div>

@jobs @jared.gibb both great answers and along the lines of what I was thinking, however, when I tried something like this, the uploaded files were still present in File Manager. I have to come up with a way to delete them from File Manager itself and it appears Bubble doesn’t provide that option at present.

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [June 5, 2022, 1:28am UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/5 "2022-06-05T01:28:08Z")

</div>

If I was faced with this decision, I would save images is a base64 string on a database thing. Then I would delete all of the things that were created 24 hours ago or greater every 24 hours.

---

<div class="post-metadata">

**Author:** ![sudsy](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sudsy/32/114637_2.png) [@sudsy](https://forum.bubble.io/u/sudsy)\
**Post date:** [June 5, 2022, 1:55am UTC](https://forum.bubble.io/t/picture-uploader-file-manager-dilemma/209748/6 "2022-06-05T01:55:32Z")

</div>

> [@sydney22](#):
>
> the latter category are so-called “orphaned” photos (i.e., not tied to a data type or saved in the database).

If you want to delete them from Bubble storage, **you can’t let them become orphaned**. You must retain a reference to any file you wish to remove from Bubble storage. That was the point of the [2 yr old thread to which you replied](http://forum.bubble.io/t/solved-preventing-orphaned-files-how-would-you-handle-it/63664/26).
