Download link doesn't work

Discussion in 'HTML & Website Design' started by Sayedtaqui, Dec 15, 2012.

  1. #1
    I m creating a religious website and wanted to give the visitors the option to Play and Download the religious songs ourshiaislam.com/nauhay/ I m using the download and the play link from the other website(with permission). When you click the PLAY button the song starts playing in a small window like I had setup however when you click on DOWNLOAD NOW button the download doesn't begin unless you have IDM or any download manager. Download manager do the download from the link very well but without the download manager the downloading doesn't start and the link opens a different page where the audio starts playing. How do I give the visitors the option to download? here is one of the link to download

    Now I used
    <a href="http://shiadownload.com/media/Nohay/Nadeem%20Sarwar/Nohay%202013/Aahista%20Chacha%202013.mp3" download=""><input type="button" value="download now" ></a>
    HTML:
    and the downloading starts perfectly in CHROME however it doesn't happen in other browsers. It doesn't even give the right click option so people can right click and do "save link as". I dont want to remove the button. Any help?
     
    Sayedtaqui, Dec 15, 2012 IP
  2. zied.ho

    zied.ho Well-Known Member

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    106
    #2
    Hi ,

    you are using the attribute "download" in link , it's a new html5 attribute & work only with new browsers
    if you need to force downloading with all browser you need to use a server side script like php


    
    list($fichier, $extension)= explode("-", $_GET['file']);
    $file= $fichier.'.'.$extension;
    $size=filesize($file);
    header('Content-Type: application/force-download; name="'.$file.'"');
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: '.$size);
    header('Content-Disposition: attachment; filename="'.$file.'"');
    header('Expires: 0');header('Cache-Control: no-cache, must-revalidate');
    header('Pragma: no-cache');
    readfile($file);exit();
    
    PHP:
    & finaly your href="forcedownload.php?file=pathtofile.mp3"
     
    zied.ho, Dec 16, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    Whether to download the file and save it or download it and run it (which is what playing a multimedia file is) is set in the browser, not on the site. The user controls whether it's saved or run, regardless of what you do on the site, and there's no way you can change that. And if HTML6 has some kind of "you must run this file, you can't save it" download property, Firefox (and probably Chrome) will come out with a work-around before anyone uses that property on a site.

    If the internet had laws, not allowing the user to choose would violate at least one of them.
     
    Rukbat, Dec 20, 2012 IP
  4. zaiem

    zaiem Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    hi,
    i have a wide experience in developing websites now i m looking forward to work as a free lancer. Give me a chance to prove my skills i m only concertrating on my quality work with customer saticsfatction.i can show u my portfolio for more details contact me on skype
    my skype name : zaeem.zam1
    with best regards
    zaeem khan
     
    zaiem, Dec 24, 2012 IP
  5. fullseoweb

    fullseoweb Greenhorn

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    use digital download software or script.. if you need help, let me know
     
    fullseoweb, Dec 25, 2012 IP