Script to download a mp3
Results 1 to 2 of 2

Thread: Script to download a mp3

  1. #1
    Junior Member
    Join Date
    Sep 2003

    Script to download a mp3

    My make a webpage from my friends band and i have mp3's on there but i when ever u clik a link to them they just play from online... i would like to know how to get it to download insted of playing offline like that is the site so if anyone could help please let me know

  2. #2
    If you have PHP capabilities with your hosting, you can use headers with the fopen feature that will force certain file types, based on what you put in your header, to download instead of just opening, thus forcing the download of an MP3 file.

    Like this:

    PHP Code:
    header("Content-disposition: attachment; filename=$filename.mp3");
    header("Content-type: application/octetstream");
    header("Pragma: no-cache");
    header("Expires: 0");


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts