Upload button - file validity check

Hi,
I am using an upload button to upload a image file to my dataset using a form.
It works fine except that if someone upload a different type of file (not an image file) like pdf it creates me problems. I would like to inform the user right away that the file isn’t the right type.
How can I do this?

Pierre Lacasse
Ibmretraitesqc@gmail.com