Forums

[Plugin: WordPress Download Monitor] Size not working? (7 posts)

  1. solefald
    Member
    Posted 3 years ago #

    hello,

    my file sizes are not showing up? is this a bug, or im doing something wrong?

    Adding {size} to custom output or directly to tag [download#1#size] does not work.

    any idea how to fix it?

    thanks

  2. Mike
    Member
    Posted 3 years ago #

    Not all servers support it and it only works with files on your own server (not external).

  3. solefald
    Member
    Posted 3 years ago #

    yes, this is on my own server.
    it's running Debian linux with apache2, mysql5 and php5.

    most common setup, really.

    is it supposed to work for me or not?

  4. solefald
    Member
    Posted 3 years ago #

    ok, i fixed it, by hardcoding my info into wp-download_monitor.php

    line 754 has flawed logic

    $path = str_replace(get_bloginfo('wpurl'),"./",$path);

    my wpurl is "http://www.domain.com/blog/", so basically your code completely strips that, and makes $path

    .//wp-content/uploads/file.blah

    which, obviously, does not work.
    my fix was to replace "./" with "blog"

    $path = str_replace(get_bloginfo('wpurl'),"blog",$path);

    but this only works for files located in $wpurl/wp-content/uploads"

    got to figure out how to make it work on existing files, located in other dirs....

  5. Mike
    Member
    Posted 3 years ago #

    Yes it must be. I think it works fine when you upload via the interface to wp-content/uploads. The reason being it needs a relative url; not an absolute url to the file.

    Maybe I can find a better way of calculating the relative url.

  6. shamasis
    Member
    Posted 2 years ago #

    w.r.t: Plugin version 3.1.5

    Aaargh .... same issue here on my site! The flaw is in the logic of creating the final path in wp_dlm_get_size() function in line 903.

    The current logic fails when wordpress core (wp-content folder) files are in a subdirectory of the blog directory.

    Had to hardcode as of now.
    $path = str_replace(get_bloginfo('wpurl'),"./mysubdirectory",$path);

  7. rohitab
    Member
    Posted 2 years ago #

    I modified it to replace the URL path with the file path. Works for me.

    $path = str_replace(get_option('upload_url_path'), get_option('upload_path') ,$path);

Topic Closed

This topic has been closed to new replies.

About this Topic