WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Download Button Not Downloading Full File

[Resolved] Download Button Not Downloading Full File

Viewing 2 replies - 1 through 2 (of 2 total)
  • OK I think I found the main problem.

    The link to the MP3 file is: https://archive.org/download/TwoDaftYanksEpisode35/TDY_EP35.mp3

    But when the file plays this is the actual address: https://ia700602.us.archive.org/7/items/TwoDaftYanksEpisode35/TDY_EP35.mp3

    The original link triggers a download that all other services can activate but for some reason the button can’t. The easy fix is just to go back and link to the actual URL that plays the file as I have for episodes 36 and 35 on my site. This allows the button to work correctly.

    Is there anything that can be “easily” changed in a short amount of time in the code that would not require me to replace every episode that has been produced?

    My guess is probably not and that is fine. Please advise.

    Many Thanks!

    Plugin Author pupunzi

    @pupunzi

    As I understand you can’t download the audio file from your WordPress repo but you can from the external link.

    The difference between the two is that in the case of same domain (your WP repo) the download page get the file navigating the file system (c://…) while from the external domain it get the file via HTTP.

    To check if that is the problem you can comment in the map_download.php file from line 13 to line 31:

    if($pos){
    
        if (isset($_SERVER['HTTPS']) &&
            ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
            isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
            $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
            $protocol = 'https://';
        }
        else {
            $protocol = 'http://';
        }
    
        $file_url = str_replace ($protocol. $web_address .'/', '', $file_url);
        $file_url = $web_root ."/". $file_url;
        $file_url = str_replace('//', '/', $file_url);
    
        //die($protocol . " --- " .$web_root . " --- " .$web_address . " --- " . $file_url );
    
    }

    forcing the download to always use the HTTP protocol.

    Bye,
    Matteo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Download Button Not Downloading Full File’ is closed to new replies.