Is there a way to detect whether a file uploaded via the image picker is an image or something else (such as a video)?

I can't think of a way to detect if a user has uploaded a non-image file and notify them to upload an image, it is essential to upload an image because it is used as the background image, a non-image file cannot be a background image. Can anyone spot my mistake through this screenshot?

Why would image picker pick a video?

1 Like

I can select other files via the image picker somehow, I don't know if other people also have this issue though.

Me too, the Image Picker allows me to select a file manager, then I can pick pdf and video mp4 files. Not tested other file types.

To answer your question, perhaps the easiest thing to do is to test the extension at the end of the filename returned.

1 Like

Can you please tell me how to do so? I'm a newbie :frowning:

Check if file path ends with .jpg or .jpeg or .png

Did you try File Picker component? Do you see same behaviour?

1 Like

Can you show me a screenshot of how you check the file paths? There are a few blocks containing 'path' and that confused me.

The imagePicker1.Selection block gives you the file path to your picked file.

1 Like

Like this?

Try this:

1 Like

Thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.