Page 1 of 1

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

Posted: Fri Dec 09, 2005 8:26 pm
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.