Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
Add Comment
Please, Sign In to add comment