I know that you can get the actual mime type of a valid image file in the getImageSize() array's 3rd element since the mime type header in the $_FILES array can be spoofed, but what if I want to handle uploading of mp3 files (or anything else, for that matter)? Is there a way to arbitrarily get the mime type of an uploaded file? I know that I could probably find documentation for the structure of each file type that I want to handle and then parse the binary data to grab the file type, but I'm not experienced in that type of programming, and I'd like to find a more elegant solution. Thanks in advance for any help.
[RESOLVED] get mime type of NON-image uploads?
the unix command "type" will make an effort at determining file types. You could exec that, and use a mapping from its possible results to mime types?
You can also use the [man]mime_content_type[/man] to examine the file and return its best guess at an appropriate MIME type (note that this will require the MIME extension to be installed). Failing that, justsomeone's suggestion is a lower-level way of achieving the same thing.
Excellent. Thanks for both of your responses!