on my website I want to allow people to upload guitar pro files. Apparently there is no specific MIME type for these (I tested and it gave me 'application/octet-stream'). Is there a way to check and be 100% sure the files are guitar pro files and not something else? Thanks
Read the first bytes from the uploaded file. For example this is how I used to check uploaded files when I was creating similar functionality.
So reading chars from 1st to 19th would give me string 'FICHIER GUITAR PRO'. This approach worked for me for gp4 files. Also I used to check files extensions. However keep in mind that there is no real check you can perform in order to filter malicious uploads since faking this first bytes as well as extension is pretty easy. So there should always be some additional moderation of all uploaded files.