PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You should consider using escapeshellcmd() when dealing with user input this way.
You could just extract the file extension from the filename and have a wild guess on the mime type based on that (not very accurate). Also, some browsers pass the mime type with the rest of the file data but again this is also not very accurate.
From what I gather though, mime_content_type just grabs the file extension and looks it up in the 'magic.mime' file (just a guess though) so presumably using my first suggestion should yeild similar results.
Yeah, looks like I will unfortunately not be able to call the UNIX 'file' command to get the MIME-type. So it appears that the only alternative is to create an array with known MIME-types based on file extensions in order to gather this information.
Oh well, although it's not the most reliable way, at least it's better than nothing.