We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


HTML code that allows the user to download an mp3

John Carney
John Carney asked
Medium Priority
Last Modified: 2012-05-11
how do I write code that will enable the user to download the actual mp3, as opposed to the code below which just plays it?

<div align="center"><a href="http://www.mysitecom/Songs/MySong.mp3">Download mp3</a></div>

Open in new window

Watch Question

Top Expert 2011

There isn't an easy answer to this. You cant do it with just some HTML. You would need some PHP or edit the .htaccess file.

I can give you instruction on this, though it doesn't work on older browsers.

The simplest way would be to either zip up the mp3 prior to upload, so it is a .zip file. This will download, though the end user will have to extract it before use.

Also, you can put in some type of instruction that says "right click and select save as".

Would you like further instruction on any of those?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

The user can Right Click and select "Save Page As" to download the file.  You can mention that on that page.  The only reason it plays is because someone has an application designated to play it.  If they don't, the browser would ask if they want to download it.
John CarneyReliability Business Tools Analyst II



Hi jonahzona, yes i would love instructions on how to do this with PHP. Thanks. Dave, I hear what you're saying but the problem is that everybody has something that will play mp3's automatically.

- John
Top Expert 2011
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
John CarneyReliability Business Tools Analyst II



- John
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.