Forum Academy Marketplace Showcase Pricing Features

Condition: File name contains text within arbitrary text

Dear Bubble community members,

I would like to prevent users from uploading files that are not images. To do this, I made a workflow that only runs when the file name contains image extensions (.png etc). I do this by adding a condition to only run when: “This PictureUploader’s value’s file name contains Arbitrary text”. This works fine when the arbitrary text is only “.jpeg” for instance, but I would like to paste a list of all the accepted file types, so that whenever there is a match the upload is accepted. In other words, I would like to write a condition like this: “This PictureUploader’s value’s file name contains (text that is within) Arbitrary text”.

Any ideas on how to achieve this?

Hi there,… as with all things Bubble, I’m sure there are multiple ways to do what you have described, and one way that comes to my mind involves an option set. You could create an option set that defines all of the acceptable file extensions, and then you could construct a condition that checks to see if the picture uploader’s value contains any of the extensions in the set. I created an example with a regular input element just to make sure I could construct a working expression, and this condition seems to do the trick.

So, that might not be the most elegant way to go about it, but it works. Hope this helps, even if it’s just food for thought.


1 Like

Thank you Mike, it works!

1 Like

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