Forum Academy Marketplace Showcase Pricing Features

[SOLVED] How to delete a field?

I have a ‘delete’ button and when a user clicks it I want their logo image to be deleted. I can’t figure this out, when I add Delete a thing in the workflow I am not given the option to delete the logo?

From your screenshot image it’s clear that your Logo field is an image (a file), not a linked datatype (a thing).

So there is no ‘Thing’ to delete, just a file, therefore you can’t use ‘delete a thing’, you need to use ‘delete an uploaded file’ instead.

Note that deleting the image from your file storage won’t clear the Image field on the thing’s database entry (the Logo field will still contain the URL of the deleted file), so you’ll need to clear the field as well as delete the file to avoid potential any problems.

1 Like

Thank you @adamhholmes for explaining that for me, it makes sense now.

1 Like

The ‘delete an uploaded file’ doesn’t delete the image, it remains in the DB. Also, the clear the field option doesn’t work either? Effectively, when I delete using the workflow below, nothing happens.

pic delete

Both of those things should work fine if you do them correctly - so either you’re doing something wrong, or perhaps there’s a bug, in which case reach out to Bubble support and submit a bug report.

That said, are you sure you’re deleting the correct file? Or any file at all (and not an empty value)? Without knowing your app I can’t say obviously, but as you’re deleting the file-uploader’s value rather than an Image field on a database entry (as your original post suggested was your intention), are you sure there’s a file to be deleted?

Does the uploader definitely have a file in its value? Is its default value the current User’s image? Or is it a recently uploaded image? Have you previously reset the input after an image was uploaded?

You should check the uploader’s value in the debugger when running the workflow - that will show you where you error lies. Or just refer directly to the User’s image in the workflow rather than the uploader’s value.

In any case, the ‘delete an uploaded file’ action works fine for me (I just tested it) so if you’re sure you’re doing it right then file a bug report. Clearing a field the way I said also works fine for me.

As for the second screenshot in your post, I’m not sure what that’s meant to show, or what it has to do with the question??? That’s just your datatype fields…

Perhaps I misunderstood your initial question and you just want to delete the actual field from the datatype? in which case just click the ‘trash’ icon next to the field… is that what you meant? Or have you posted the wrong image?

No you didn’t, I literally just want to delete the photo from the DB. I have manually deleted the image and tried again, but this time I can’t even save an image so I am more confused than before.

I have an upload and trash function. The upload function modifies the ‘Logo’ field.

When I attach an image, I see it appear on the website in ‘Preview’;


But the DB has nothing. I can not save or delete the image from the User Thing. Also, I am using auto binding instead of a save button which may be why I am having issues?

Yes, I think you’re confused about a number of things here…

I literally just want to delete the photo from the DB

Firstly, photos aren’t stored in the DB. Images (and all files) are stored in your file storage. You can refer to images (or other files) from your file storage in the DB in image (or file) fields, but the files themselves are stored in your file storage (assuming you’re using Bubble’s storage. If you’re using an external storage provider then they’ll be stored there).

It seems to me you’re not clear on the difference between the two concepts…

You can’t delete a photo from the database, as it’s not in the database, it’s in your file storage. You either clear the Image field on the datatype, to disassociate that image from the database entry, or you delete the file itself from your file storage (or both).

To delete an image (or a file) from your file storage you need to use a ‘delete an uploaded file’ workflow action, and point to the specific file URL.

Do ‘disassociate’ a stored image (or file) from a database entry’s image field, just set that field to blank in a workflow (or point it to a new image instead).

As I said before, deleting a file from storage won’t affect any database entries that refer to that file.

So if you have set a stored image on a datatype’s image field, and then delete that image from your file storage, the datatype image field will still refer to the URL of that image, even though the image no longer exists.

I can not save or delete the image from the User Thing

Impossible to give any advice here without seeing your workflows, so feel free to post some screenshots for analysis, although if you’re using autobinding perhaps the parent group’s datasource is set up incorrectly or there are privacy rules causing issues.

Thank you for letting me know this, I can see the stored files in my file storage but I wasn’t aware this is not part of the overall DB.

But how!?

Good news is that I can now upload an image and it is saved to my file storage, but clearing it does not work. I only see an option to ‘delete’ the file, see below:


UPDATE: I found an old post of yours @adamhholmes and you said to set the image to a blank value (or words to that effect) and this did the trick to disassociate it from storage. Here’s the solution;


Funny, it now seems obvious, the image file is saved in storage as a URL, so if Logo = nothing then there will be no image to display!

Thanks again for your help!

1 Like