So as I am creating a site that deals with uploads of a variety of kinds, I am coming across mime types that don't exist on every OS/browser and that are unexpected. Examples are the image/pjepg(Windows) and recently mp3 come in as audio/mp3(chrome) and not audio/mpeg.
So I was wondering is there a standardization of mime types for PHP? Or is it based on operating system and browsers?
There is a standard for these types, however they are not always effectively enforced by browsers. For example Internet Explorer does not support the 'application/javascript' type, you have to use 'text/javascript' even though this is deprecated.
Please see the following link for the types and their corresponding documentation:
http://www.iana.org/assignments/media-types/index.html
You should never trust the uploader-supplied MIME type information anyway, since it's easily faked. Depending on what you do with the files, in extreme cases this may lead to buffer overflow attacks against you or your users. You should try to determine the MIME type yourself, for example using the Finfo functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With