Question
Commonwealth Bank
AU
Last activity: 10 Mar 2020 0:12 EDT
How to check the MIME Type of a file before upload
We have implemented the file type(extension) checking based on file name (sample.txt) and restricting the user to upload certain types of files.
There is a possibility of changing the extension of different file type and upload to the application.
Ex: User has an executable file webex.exe and this can be changed to webex.png by renaming it and can be uploaded.
How to check the file type(or mime type) based on the content (not just the filename)?