jmicah 0 Posted September 29, 2009 Report Share Posted September 29, 2009 I'm trying to create a link that would allow the user to download an mp3. I thought this would work <a href="clip.mp3">Download Here</a> but it just takes me to a seperate page that plays the mp3.I know you could just right click and save target as but I was hoping to make it easier for the user.I've been searching around for a few days with no luck. Any help out there?Thanks in advance. Quote Link to post Share on other sites
Ingolme 1,020 Posted September 29, 2009 Report Share Posted September 29, 2009 I don't think Internet Explorer uses the attribute correctly, but type should solve the problem: <a type="application/octet-stream" href="clip.mp3">Download here</a> 1 Quote Link to post Share on other sites
jmicah 0 Posted September 30, 2009 Author Report Share Posted September 30, 2009 Thanks for the response Ingolme.I tried using type but it still tries playing the mp3 in the browser. I tested with Firefox and Safari.I'm looking for a solution similar to when you click a link and it pops up an alert asking if you want to "Run" or "Save" the file. Quote Link to post Share on other sites
jmicah 0 Posted September 30, 2009 Author Report Share Posted September 30, 2009 I just found the answer to my question with a little more searching.The solution is to create a php file like so <?header('Content-type: audio/mpeg');header('Content-Disposition: attachment; filename="audioclip.mp3"');?> Then just link to the php file <a href="download.php" target="_blank">Download MP3</a> Hope this helps someone else in the future. Quote Link to post Share on other sites
General Lee Nice 0 Posted February 5, 2014 Report Share Posted February 5, 2014 (edited) This will allow you to do it in HTML <!-- from <ahref to </a> --> <!-- <a href="http://www.WEBNAME.com/Folder/TestFile.mp3" download="filename">› Download TestFile Mp3</a><br> --> Edited February 5, 2014 by General Lee Nice Quote Link to post Share on other sites
Ingolme 1,020 Posted February 6, 2014 Report Share Posted February 6, 2014 This thread is from over four years ago, the download attribute didn't exist then. Quote Link to post Share on other sites
Joseph C R 1 Posted February 15, 2014 Report Share Posted February 15, 2014 I'm using one of your center div table commands as a future back drop table to hide my space background to give the page my space age look. The table is 1301 px in width, I have enough room to actually place my futuristic scrollbar. I'm playing with that table code you gave me. Can I use that to continue my unique look and feel? The space ship has to stay. lol are these table codes acceptable to web developers? If so, I'm on right track now...... I hope? 1 Quote Link to post Share on other sites
php freelancer 0 Posted June 24, 2014 Report Share Posted June 24, 2014 I just found the answer to my question with a little more searching.The solution is to create a php file like so <?header('Content-type: audio/mpeg');header('Content-Disposition: attachment; filename="audioclip.mp3"');?>Then just link to the php file<a href="download.php" target="_blank">Download MP3</a>Hope this helps someone else in the future. Thanks for this help. Quote Link to post Share on other sites
L8V2L 5 Posted July 21, 2014 Report Share Posted July 21, 2014 Ingolme.... How old are you???? Where you there when God form the seas?P.s. We need more peeps in the xml area. Quote Link to post Share on other sites
shakir 0 Posted August 17, 2014 Report Share Posted August 17, 2014 I think @phpfreelancer which one he gave to you the code it's might be helpful for you best of luck. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.