Reply to Re: How to download MP3 and not play

Your name:

Reply:


Posted by J.O. Aho on 11/17/07 05:16

nospam wrote:
> Hello,
>
> I want to create a hyperlink to let users download MP3's when they click.
> The default behavior is to play. I know they can right-click and save as,
> but I don't want to have to tell them that. I also have a MP3 player already
> playing on the page.

You can do this without a bit of "hacking", and there are better and worse
ways to do this.

1. You can use a script that sends the file in question, first it sends a
false header that tells that the file isn't a mp3, this has the advantage of
that the file don't have to be renamed.

2. Archive the file with gzip, as a browser that knows a bit about standard
(of course the user settings applies here too) would unarchive the file.

3. Change the file extension.

4. Modify the servers mime types (has the disadvantage that all mp3 would
become downloadable only)


> I don't want to do FTP and expose user/passwords, etc.

Switching protocol won't change how a browser will behave.

--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация