why does browser add .mp3 to audio files?

5 posts / 0 new
Last post
catmistake's picture
Offline
Last seen: 2 years 5 months ago
Joined: Dec 20 2003 - 10:38
Posts: 1100
why does browser add .mp3 to audio files?

I'm not a web designer... just a lazy webserver user. Lots of times, I just throw files in a directory, then link to the directory. My sites are only used by the folks I give links to, so its not a big deal.

But I've noticed some weird behavior that doesn't happen with other file types. Even if I put an index page with links to files, this still happens, and I don't know why. Its espescially troublesome to windows users who half the time don't see file types or even know what that is.

Here's what happens:
Lets say its a simple index page with links to .m4a format files (one of Apple's broken .mp4 types). If the user right-clicks and downloads the file, you'd expect it just to download where they save it as what it is. But the browser (or the webserver) adds a .mp3 to the end... (so 'song.m4a' would turn into 'song.m4a.mp3') and its not an mp3 file, so a player will think its corrupt. What's weird is if they just click the link, opening the file in the browser, it will probably play fine.

Its not just IE. Safari does this too. Is it the server?

What's going on here? How do I fix/prevent this?

catmistake's picture
Offline
Last seen: 2 years 5 months ago
Joined: Dec 20 2003 - 10:38
Posts: 1100
not cool, but...

unfortunately, this is one I'm not going to devine, figure out or otherwise stumble across the solution on my own.

At the risk of comment abuse, I'll post the link to the very page (of mine) that I mean.

While these days, I'm getting 1Mbps down, the upstream is, relatively, very slow (though twice as fast as its been). There's no need to download the entire file if you merely want to see what I'm talking about (but I won't stop you).

Really, though all can see, this post is sort of specifically for the wrecking crew here, Eudi., Rev. Darkness, iantm, coius, doug-doug, davintosh, Ultimate, Jon, digital, any admin/moderator, HC, any username starting 'Dr' and any I may have overlooked, etc., who want to help, and not for the merely curious, so I'll just ask that you temper your clicks so my provider doesn't drop me (technically, I'm not supposed to have any servers).

For the purposes of an example of the problem only--EDIT- solved & deleted

To duplicate the issue, after loading the page:

  • in Safari, option click one of the links, and look in the download window at what Safari does to the name.
  • in IE, right-click and save as on a link, and look at what the default name tries to be

What's odd is that if you just click the link to load the file in the browser, it will work.

SO... what is going on here? Why the superfluous auto adding the incorrect file type? Is this server side or browser side (that I can fix via server parameters?) ?

catmistake's picture
Offline
Last seen: 2 years 5 months ago
Joined: Dec 20 2003 - 10:38
Posts: 1100
plz reply here, not to the above post

Thanks

Edit--
Have I 'stumped' the forum?
Its apache2, btw, default LAMP install on ubuntu server 6.10. But the same thing occurs with apache on OS X.

Eudimorphodon's picture
Offline
Last seen: 4 months 2 weeks ago
Joined: Dec 21 2003 - 14:14
Posts: 1207
Mime types

Run the command "curl -I (url of one of your music files). Look at the output:

HTTP/1.1 200 OK
Date: Wed, 16 May 2007 19:01:08 GMT
Server: Apache/2.0.55 (Ubuntu) PHP/5.1.6
Last-Modified: Sun, 13 May 2007 18:50:17 GMT
ETag: "3fe6a8-4eeb9d-78b48c40"
Accept-Ranges: bytes
Content-Length: 5172125
Content-Type: audio/mpeg

Note the last line, "Content-Type: audio/mpeg". That's your problem. Certain (annoying) browsers like Safari insist on tacking on whatever extension they consider "appropriate" for a given mime type when saving it.

You can try adding something like this in the appropriate section of httpd.conf:

AddType audio/mp4 .m4a .m4p

And see if it helps or makes the problem worse.

--Peace

catmistake's picture
Offline
Last seen: 2 years 5 months ago
Joined: Dec 20 2003 - 10:38
Posts: 1100
ReMime types

Note the last line, "Content-Type: audio/mpeg". That's your problem.

Yup. Much obliged!

What's weird... those files were created with iTunes...

edit:
ok, but mp4 is still mpeg.... tricky

Log in or register to post comments