Jump to content

Creating An Mp3 Download


Recommended Posts

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.

Link to post
Share on other sites

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>

  • Like 1
Link to post
Share on other sites

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.

Link to post
Share on other sites
  • 4 years later...
  • 2 weeks later...

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?

  • Like 1
Link to post
Share on other sites
  • 4 months later...

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.

Link to post
Share on other sites
  • 4 weeks later...
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...