• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

HTML code that allows the user to download an mp3

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?

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

Open in new window

0
gabrielPennyback
Asked:
gabrielPennyback
  • 2
  • 2
1 Solution
 
jonahzonaCommented:
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?
0
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
gabrielPennybackAuthor Commented:

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
0
 
jonahzonaCommented:
Here is a full description on how to accomplish this.

http://www.ryboe.com/tutorials/php-headers-force-download
0
 
gabrielPennybackAuthor Commented:
Thanks!

- John
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now