如何从其他网站下载WordPress上传文件夹中的文件?

I am trying to download a file with login authentication using WordPress database, I am using the below code to download file from WordPress upload folder. But unfortunately, I am unable to download the requested file and no error message. Can any one help me to fix this issue.

if (isset($_GET['downloadfile'])) {
    $posts_id = $_GET['downloadfile'];
    $sql_app = $auth_user->runQuery("
        SELECT DISTINCTROW AA.post_id, 
            BB.`meta_value` AS 'resume' 
        FROM `wp_postmeta` AS AA 
        LEFT OUTER JOIN `wp_postmeta` AS BB ON AA.post_id = BB.post_id 
            AND BB.meta_key ='resume'
        WHERE AA.meta_key IN ('resume')
            AND AA.post_id=:posts_id
            GROUP BY AA.post_id
            ORDER BY AA.post_id DESC
    ");
    $sql_app->execute(array(":posts_id"=>$posts_id));
    $downRow=$sql_app->fetch(PDO::FETCH_ASSOC);

    $filepath = $downRow['resume'];
    // Process download
    if(file_exists($filepath)) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="'.basename($filepath).'"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($filepath));
        flush(); 
        readfile($filepath);
        exit;
    }
}