I need to make a script that will take files from a user and upload them to a server. I’ve already done this one and on my first attempt, I built in some checking to ensure that the correct mime type was being uploaded. Today, I have learned that browsers interpret mime types differently. This makes me think that maybe it isn’t worth checking after all. The last thing I want is for a user to tell me that they can’t upload a file because their browser doesn’t handle mime types in the same way that my mine does.
What can anyone suggest. Should I forgo the mime type and check extension or is there a better way of doing this? I know that there is a CURL option for this but I think that is going to be overkill for this situation.
Take a look at FileInfo. Never rely on any data given to you by the user / browser for validation.