How to validate the types of files uploaded with a File Upload?

How to validate the types of files uploaded with a File Upload?

Hello
I am developing an application where I plan to upload files with only .pdf extension. I'm using a File Upload element but I don't know how to validate the extension of the elements that are uploaded.
Could you help me with this problem?
Greetings.