File upload content type issue

Hi Team,
I found a weird issue on file upload. I have added validation condition on types for allowing to upload the only PDF. But the system allows uploading any file if I simply change the file extension. it is not exactly checking the proper content type/mime type of the uploaded file.

What could be the right solution if I want to check the upload file content type?