mp2 stored as ".mp3" or ".mp2.mp3"

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

mp2 stored as ".mp3" or ".mp2.mp3"

Post by ^rooker »

[PROBLEM]
When trying to download an .mp2 file from a website, your browser client might automatically choose the suffix ".mp3".
(or e.g. Firefox adds the suffix to the original one: .mp2.mp3)

Additionally, the save-dialog says that it's an MP3 filetype.


[SOLUTION]
The problem is mainly that by default, apache offers "mpga", "mp2" and "mp3" as MIME type "audio/mpeg" (or "video/mpeg") in mime.types:

Code: Select all

audio/mpeg                     mpga mp2 mp3
video/mpeg                      mp2 mpe mpeg mpg

Unfortunately, there's no standard well-known MIME type for mp2, so there's no 100% clean solution for this problem.

BUT: I simply split those types up to be:

Code: Select all

audio/mpeg                      mpga
audio/mpeg2                     mp2
audio/mpeg3                     mp3
which results in the browser resolving it to the only MIME type it really knows for mp2: video/mpeg

- and that doesn't have a default suffix.
Post Reply