5

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?

0

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

0

Well, there's no php-specific mime standard, there are RFCs (2045, 2046) that specify common media types.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.