• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Download Monitor & Manager Plugin

Simple Download Monitor & Manager for WordPress

  • Home
  • Documentation
  • Addons/Extensions
  • Login
    • Sign In
    • Edit Profile
    • My Downloads
  • Support
    • Tutorials
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration
  • Contact Us
You are here: Home / Topics / Hidden download plugin problem

[Resolved] Hidden download plugin problem

· ·

WordPress Download Monitor Plugin › Forums › Download Monitor Plugin Forum › Hidden download plugin problem

  • This topic has 6 replies, 2 voices, and was last updated 5 years, 1 month ago by vavw.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • April 20, 2020 at 12:27 am #1531
    vavw
    Participant

    Hi,

    I purchased the Hidden Download plugin today. Unfortunately, I can not get it to work properly.

    On my new website I wish to share content in large zipfiles that can be downloaded from my NAS at home. The links to the files are created by my NAS and end in, for example: /nas/filelink.lua?id=1234567890
    When downloading a file by pasting the original download link in a browser, the linked zipfile is downloaded in the original format, for example: filename.zip.
    However, when creating a hidden download link using the plugin, the downloaded filename is “filelink.lua?id=1234567890” instead of “filename.zip”. The file can not be opened, unless the .zip extension is manually added once the download is complete. The content of the download is unaltered, it is the name of the downloaded file that is the problem caused by the plugin: the original file name of the original file (not the download link) should be maintained, as should the .zip extension.

    Is this something that can be fixed in an update?

    Thanks,

    Victor

    April 20, 2020 at 1:17 am #1532
    admin
    Keymaster

    It tries to read the filename by using the PHP basename() function. So it needs a direct link to the static file (not to another script which will manage the file):
    https://www.php.net/manual/en/function.basename.php

    It is likely that function is failing to read the file name. The setup you explained is not a standard one for handling download via PHP system so I am not 100% sure if it will work but it is worth trying the different download method settings offered in the hidden downloads addon. Go to the “Hidden Download” menu in your WP Admin interface. Then try the different URL conversion and download method options to see if it can handle the download better.

    April 20, 2020 at 1:31 am #1533
    vavw
    Participant

    Thank you for your fast reply.

    The three URL Conversion options (Absolute / Relative / Do not convert) in combination with Download Method 1 all have the same result, as described above.

    The same happens with Download Method 2, 4, 5 & 6.

    Method 3 gives a Bad Gateway.

    Method 7 & 8 add “.html” to the name of the download.

    If this can not be fixed by means of a plugin update, can it perhaps be tweaked so that the name of the downloaded file can be entered, converting any unwanted filename (“filelink.lua?id=1234567890”) without an extension to a preset one with the desired extension (“filename.zip”)?

    April 20, 2020 at 1:43 am #1535
    admin
    Keymaster

    Lets try a little test with some PHP code tweaks to see if it works. We can then add a filter in the addon so it can be customized without modifying the core addon’s code in the future.

    1) Open the following file of this addon:

    sdm-hidden-downloads/sdm-hd-download-handler.php

    2) Find the following line of code in that file:

    
    $file_name = basename($file_path);
    

    3) Replace it with something like the following:

    
    $file_name = basename($file_path);
    
    $file_parts = pathinfo($file_path);
    if (empty($file_parts['extension'])){
        //Missing extension. Manually force it to have .zip extension
        $file_name = $file_name . '.zip';
    }
    

    Please note that I have written this code from the top of my head. It hasn’t been tested. So make sure to change this code via FTP so you can revert the changes (by replacing with the original file) easily if something goes wrong.

    April 20, 2020 at 8:21 am #1536
    vavw
    Participant

    I replaced the code as instructed above but it does not change anything. The download file name remains identical to the NAS file id, without the .zip extension.

    In addition (something that also does not fix the problem but perhaps it is something you can look into): I created a 301 redirect to the download file on my NAS and used the “new” link as the download link for SDM. This results in a 502 Bad Gateway – “The proxy server received an invalid response from an upstream server.”

    April 21, 2020 at 7:03 am #1538
    admin
    Keymaster

    Maybe hardcode the name like the following (so it always appends .zip to the file name).

    
    $file_name = basename($file_path);
    $file_name = $file_name . '.zip';
    

    Does that make any difference?

    Regarding the 502 error, you need to look at the server’s error log to see what exactly is triggering that. The error log will have clue as to what specific function call is failing on this site.

    April 21, 2020 at 12:35 pm #1539
    vavw
    Participant

    The good news is that the code above adds the .zip extension to the download. So that works.

    However, when using the hidden download option [sdm_hidden_download id=”1234″] the name of the downloaded file is still that of the download link, instead of the file.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

Primary Sidebar

Featured Addons

  • Squeeze Form Addon
  • Hidden Downloads Addon
  • Amazon S3 Integration

Support Links

  • Support Forum

Search

Featured Plugin

WP Express Checkout Plugin

Start managing and tracking your file downloads with the simple download monitor plugin. Download Now

Copyright © 2025 | Simple Download Monitor | A member of the Tips and Tricks HQ family.