Forum Academy Marketplace Showcase Pricing Features

Can someone pls help me deleting uploaded picture using backend workflow?

Hi folks, I’m having a a bit of a problem with deleting a file that’s uploaded via PictureUploader here, I would be really appreciated if someone can give me a hint of how to figure out this problem.

1, I’m making a custom printing T-shirt order app, each orders will be custom and unique.
2, User can upload and change their pictures via PictureUploader to try the look on the shirt .
3, I’m achieving this feature using two PictureUploaders (PU-A and PU-B).
The reason for having two uploaders is

  • Bubble’s PictureUploader, by default, keeps adding pictures to DB(file manager) when you change a picture and weirdly “Delete uploaded file” event on the the same uploader will delete the one you just added. (This is dumb, I have reported a bug issue on this)
  • I need to delete the first image from the DB(file manager) when the user uploads a new image, so I added another PictureUploder to make sure “Delete uploaded file” event works.

The Action Flow
User uploads img on PU-A >>> user checks >>> user uploads new img on PU-B >>> deletes img on PU-A by delete event >>> back to beginning, but this time delete img on PU-A

Doing this by show/hide PU-A and PU-B so the user won’t see both PU-A and B

and finally, here is my question for this topic.

How can I delete the uploaded image that didn’t use for an order? For ie… user failed to order, lost interest or closed the window whatever.

If I don’t delete this picture somehow (suspecting the backend workflow?) Bubble keeps adding unneeded images to the DB.

I see the unneeded uploaded picture has a user ID, maybe I can retrieve this to point out which photo to delete?

Anyone?

Push the old image to a state, and remove that old image if the picture uploader changes. Not a solid solution but it kinda works fine

1 Like

Thanks nocodeventure, It worked! that was super easy!

Setting custom state >>> Delete the PictureUploader’ value

Another option is if you schedule it to be deleted in the backend using backend workflows.

You could also set the value on the user if they’re logged in and delete it after a day or so if it’s not used.

Using states doesn’t help when you refresh the page.

1 Like

Ok great, thanks for the cent.

This is a single time order so I probably don’t need to use the scheduling yet but I’ll keep that in my mind. Thanks again you’ve made my day!

This topic was automatically closed after 70 days. New replies are no longer allowed.