WordPress.org

Ready to get started?Download WordPress

Forums

Easy Download Media Counter
Download files are empty when you download them (2 posts)

  1. JohnnyN05
    Member
    Posted 1 year ago #

    Hi there!

    It seems it gives the wrong attachment file when downloading. It's getting the current download directory instead of getting the actual attachment. So a month later, the file won't download.

    I fixed it with this:

    //Getting the path to work with filesize()
    //$wp_upload_dir = wp_upload_dir();
    //$current_upload_dir = $wp_upload_dir['path'];
    //$filepath = $current_upload_dir.'/'.$file_name;
    
    // get real path of file
    $filepath = get_attached_file( (int) $_GET['edmc'] );

    Or this could work too:

    //Getting the path to work with filesize()
    $wp_upload_dir = wp_upload_dir();
    $current_upload_dir = $wp_upload_dir['basedir'];
    $filepath = $current_upload_dir.'/'.$file_name;

    Thanks!

    http://wordpress.org/extend/plugins/easy-download-media-counter/

  2. Remi Corson
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.