Creating a download file link

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

xMikex

Thread Starter
Joined
Nov 7, 2005
Messages
159
I would like to create a link that just downloads an mp3 file not play it. Can someone show me how to do this?

Thanks
Mike
 

xMikex

Thread Starter
Joined
Nov 7, 2005
Messages
159
Sequal7 said:
Zip the mp3 file, then create the link to it.
I would do that but i have to many audio files and i dont want to take up to much space on my server.Any other way of doing this?
 
Joined
Apr 14, 2001
Messages
2,382
You mean other then telling browsers to right click and "save as" for the file instead of left clicking? None that I am aware of for html files, it can be done in php or asp but you would need to store them dynamically (databases)
 
Joined
Jul 8, 2002
Messages
14,681
PHP:
<?php
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=file.mp3;');
readfile('filename.mp3');
?>
 

xMikex

Thread Starter
Joined
Nov 7, 2005
Messages
159
brendandonhu said:
PHP:
<?php
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=file.mp3;');
readfile('filename.mp3');
?>
Thank you that will work fine
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top