• How do I print crc-32/MD5/SHA-1 for the file in question in the custom template content-download-custom.php ?

    My goal is to get the template to print:

    filename.ext (filesize;donload_count)
    MD5: xxxxxx
    CRC-32: xxxxxxxxxxxx
    SHA-1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Can’t quite figure out how to get the file location and use it in md5_file($file_location).

    http://wordpress.org/plugins/download-monitor/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter itaushanov

    (@itaushanov)

    $filename = $dlm_download->get_file_version()->url; $filemd5 = md5_file($filename); echo $filemd5;

    Hmm, this seems to work if “deny from all” is removed from .htaccess in dlm_uploads directory where the file is, which shouldn’t be done afaik.

    What would be a proper way to do this task?

    Thread Starter itaushanov

    (@itaushanov)

    Shameless bump

    This isn’t the answer you want to hear, but I do not suggest including this information in the template. The problem is these hashes will be calculated every time a user loads the page. If you have some large-ish files, this is very cpu intensive for a simple web page. The better option would be for the developer to include an option to calculate the file hashes when they’re added to Download Monitor and incorporate a code like $dlm_download->get_the_md5_hash().

    Thread Starter itaushanov

    (@itaushanov)

    That would be a great addition to the plugin itself. Thanks for your input.

    Now I can only hope the author reads this and have the time and willingness to implement it.

    If you want the author to notice this recommendation, you would probably do better to contact him via GitHub or his website than via these forums.

    Thread Starter itaushanov

    (@itaushanov)

    Will try that, thanks.

    The request at GitHub:
    https://github.com/mikejolley/download-monitor/issues/104

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Print crc-32/MD5/SHA-1 in custom template’ is closed to new replies.