Viewed   101 times

I'm trying to decide which mime type to choose for returning mp3 data (served up by php)

according to this listing of mime types:

.mp3    audio/mpeg3
.mp3    audio/x-mpeg-3
.mp3    video/mpeg
.mp3    video/x-mpeg

What are the difference between these, and which should I use?



Your best bet would be using the RFC defined mime-type audio/mpeg.

Friday, October 21, 2022

If your using Apache .htaccess can be used to map mime types.

moreinfo Here is IANA's List of MIME TYPES

Monday, November 14, 2022

I found that by using this instead, I get the correct mime type:

$finfo = new finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['uploadName']['tmp_name'][$key]);

And as Martin mentioned in a comment above:

You should not grab the MIME type from the data given in $_FILE as this is extremely flaky and up for interpretation, as you are experiencing. Instead, do a new analysis of the uploaded temporary file, Use finfo() or similar.

Saturday, September 10, 2022

RFC 7111

There is an RFC which covers it and says to use text/csv.

This RFC updates RFC 4180.


Recently I discovered an explicit mimetype for Excel application/ It was registered with IANA in '96. Note the concerns raised about being at the mercy of the sender and having your machine violated.

Media Type: application/

Name Microsoft Excel (tm)

Required parameters: None

Optional parameters: name

Encoding considerations: base64 preferred

Security considerations: As with most application types this data is intended for interpretation by a program that understands the data on the recipient's system. Recipients need to understand that they are at the "mercy" of the sender, when receiving this type of data, since data will be executed on their system, and the security of their machines can be violated.

OID { org-id ms-files(4) ms-excel (3) }

Object type spreadsheet

Comments This Media Type/OID is used to identify Microsoft Excel generically (i.e., independent of version, subtype, or platform format).

I wasn't aware that vendor extensions were allowed. Check out this answer to find out more - thanks starbeamrainbowlabs for the reference.

Monday, December 5, 2022

XHTML 5 is not a standard. XHTML 2 does prescribe a new doctype, though XHTML 2 is not supported by any modern browsers (as it is largely unfinished).

HTML5Doctor recommends that if targeting an "XHTML5" approach, simply use the HTML5 doctype, which makes sense. The HTML5 doctype is compatible with IE7/8.

Remember, to use HTML5 (properly) in IE <9, you need to include the HTML 5 shiv.

Also, in terms of a MIME type for XHTML5, you MUST serve the content with application/xhtml+xml or application/xml, which older version of IE will NOT support. Thus, if you're trying to take a purist approach, you CANNOT have IE 6/7 support.

Saturday, December 17, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :