Validate s3 upload only when file name have a detrmined prefix

Hello. I'm looking at how to validate in a button that uploads to s3. The required scenario is that the file will be uploaded only if its name has a certain prefix.

Thanks in advance

Hi @mpugaf, great question! :slightly_smiling_face:
There are a few ways that we can do this. I recommend creating event handlers for our submit button.

For example,
If we have a "File Input" and a submit "Button," we can add two click event handlers to our submit button. One of them will be to show a notification to the user if the file did not have the correct prefix, and the other one to run the query that uploads the photo if it did.

Submit Button settings on the inspector.
This first event handler is to notify our users they need the right prefix on their file:

This second event handler is to run the query that uploads to our S3 bucket:

This way, our users can only upload a file it has the prefix we require, thus keeping bucket organized. :card_file_box:

Let us know if you have any questions!

1 Like