|
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
Navigation:
[Reply to this message]
|