linking to mp3

Discussion in 'HTML & Website Design' started by zeroxme, Jan 30, 2008.

  1. #1
    I need some help on linking to mp3 files

    I have various mp3 files which i want members to be able to download but at the moment when i click on the download link it just opens up in a new window that displays the quick time player and plays the file, is there a way to not make it automatically play, but instead the box comes up and asks you, do you want to open this or save this file.
    adding them to a zip file is no good before any one suggests that.
     
    zeroxme, Jan 30, 2008 IP
  2. nabz245

    nabz245 Well-Known Member

    Messages:
    677
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Two way..
    Tell them to right hand click and press download.

    Or..

    If you have php on your server, create a file which forces downloads.
    If you want, i can find you the code for it, i got it somewhere.

    Regards.
     
    nabz245, Jan 30, 2008 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    You could use one of many free swf mp3 players, just embed it on your site
     
    frankcow, Jan 30, 2008 IP
  4. nabz245

    nabz245 Well-Known Member

    Messages:
    677
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #4
    That's true, but i think he wants to be able to download.

    Anyway heres and example of forcing download.

    
    <?
    $link = "DOWNLOAD LINK HERE"
    header("Content-type: audio/mpeg;\r\n");
    $head = "Content-Disposition: attachment;\r\n";
    header($head);
    readfile($link);
    ?>
    
    Code (markup):
     
    nabz245, Jan 30, 2008 IP
  5. zeroxme

    zeroxme Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks for that it is a php site using joomla so this should work well i will let you know ;)
     
    zeroxme, Jan 30, 2008 IP
  6. zeroxme

    zeroxme Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    mmm cant seem to get that to work quite right here is the line of code with the link in it

    echo "<td align=\"left\" class=\"songtitle\">".$value->song." <a href=\"images/stories/audio/$value->songmp3\" target=\"_blank\">download</a></td>";
    Code (markup):
     
    zeroxme, Jan 30, 2008 IP