Welcome to TalkGraphics.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2011
    Location
    UK
    Posts
    93

    Default Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    Is there a way of doing this? At the moment when I "link to file" then test, when I click the button it opens up in Quicktime within the browser.

  2. #2
    Join Date
    May 2011
    Location
    UK
    Posts
    93

    Default Re: Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    (Can't edit last post). Just discovered it's actually because of browsers that do this automatically, I need something called "forced download" and seem to require some kind of HTML command. Have been messing around with the Placeholder / HTML code but pretty clueless!

  3. #3
    Join Date
    Mar 2009
    Posts
    4,504

    Default Re: Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    What about adding this simple direction to your link: "To download, right-click and select 'Save as'"

  4. #4
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,044

    Default Re: Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    A couple of solutions :-

    1. If you have an Apache server
    Add AddType application/octet-stream .mpg to your .htaccess file.

    2. If you are running PHP
    Link using <a href="download.php?file=test.mp3">some.mp3</a> and use

    Code:
    <?php
    
         $file = $_GET['file'];
         $dir = "path/to/files/";
    
         if(!file)
         {
             die('file not found');
         }
         else
         {
             $local_file = $dir . $file['filename'];
             $file = fopen($local_file, "r");  
    
    
             header("Cache-Control: public");
             header('Content-Type: application/octet-stream'); 
             header("Content-Description: File Transfer");
             header("Content-Disposition: attachment; filename=$file");
             header("Content-Transfer-Encoding: binary");
    
             // set download rate
             $download_rate = 100.0;
             // fetch the file
             fread($file, round($download_rate * 1024)); 
             // close the file stream
             fclose($file);
         }
         ?>

  5. #5
    Join Date
    May 2011
    Location
    UK
    Posts
    93

    Default Re: Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    Thanks both. Boy: Good idea, I have done that on my sites and it would be a solution, it's just I don't want people to be able to read PDF's and play mp3's from my bandwidth I just want them to download it once.

    Drwyd: One is on Apache so I could try htaccess for that as you suggest (I take it you mean mp3 not mpg for that?).

    I've done a promotional offer giving away free stuff so bandwidth is starting to get a bit bottlenecked on the weekend. I have thought about having only 1 zip file for all 42 mp3 tracks (75MB), I was concerned some people might not be familiar with unzipping but recently it seems most systems like XP and Vista can unzip zip files already.

  6. #6
    Join Date
    Mar 2009
    Posts
    4,504

    Default Re: Getting mp3 downloads to open in "Save Window" rather than onsite (WDPremium7)

    Quote Originally Posted by Arpeggio View Post
    Thanks both. Boy: Good idea, I have done that on my sites and it would be a solution, it's just I don't want people to be able to read PDF's and play mp3's from my bandwidth I just want them to download it once.

    ....

    I have thought about having only 1 zip file for all 42 mp3 tracks (75MB), I was concerned some people might not be familiar with unzipping but recently it seems most systems like XP and Vista can unzip zip files already.
    Another option you might consider is having a zip file for each track.

 

 

Bookmarks

Posting Permissions

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