I have some MP3 files on a website (yes, I have permission to distribute them). When someone clicks the link, I would like the Save dialog box to open without requiring a ‘right-click save as’ action.
How do I code the link to do this?
Thanks in advance.
What happens when someone left clicks on it at the moment? Does it just play the mp3 from the web?
If it’s just a link straight to the file, it should pop up the dialog automaticaly…
You can’tdirectly control what happens when someone clicks the link, because it depends on his browser and settings.
I think there is also no need to, as people usually have set it the way they like and would only be confused if it was different for every site. If you put the link directly to the file, people will be alright with it.
Here is an example link:
If I clink left-click on it, it will play in winamp. If somebody else clicks on it, it might put up a download dialog, or play in his faourite mp3 player.
If you have a lot of MP3s and want people to be able to download them together without lots of clicking you could offer them all in one zip file.
Maybe this helps:
Put something like this in a .htaccess:
<FilesMatch "\.(mp3)$" >
And if you’re using PHP:
The method explained in the link above tells Apache to parse files with an mp3 extension as a PHP file. Then in the PHP file (that’s disguised as an mp3 file) you throw a certain header to the browser that tells it to download instead of streaming, and the PHP file starts to pump the contents of the real mp3 file to the browser. This can be done with other scripting languages too I think.
LOL the Q in the above link looks like it could be a G with the underline.
This site could be for two things:
Someone’s cigarette collection or an online community for drag queens.
Fortunately, the web address doesn`t exist
Thanks for bringing that up alltaken. Made me laugh
It could also be a site dedicated to someone’s favorite bundles of sticks %|
Still funny though
Solo: you tried to go there?
Solo: you tried to go there?
That is a personal question and one that I don’t feel comfortable answering on such an open forum - so I’ll just lie and say that I got a friend to try it for me
PS: I would still really like to see someons’s cigarette collection :Z
Right now if you left click the file it tries plays the MP3 in the browser.
Yes, I’ve learned that some browsers can be set to a certain preference for opening or saving.
Thanks for the FAQ. I think that is what I want. I don’t want it to be a .zip, but I’ll try hiding the type.
i know for sure that editing your .htaccess file can do it. that is why when you go to my website to download the toxicX it opens a save dialog instead of openning the python file in the browser.
just add this in the .htaccess file:
AddType application/octet-stream py
replacing the “py” with whatever ending you want, mp3, rm, wmv…