pdf file not downloading
<p>I am using following code to start downloading but the pop-up for download is not opening. Instead, it shows the binary format of that pdf file. It's working perfectly on local server but not working hosted server.</p>

<pre><code>     $file = '../Notes/chapter01.pdf';


if (file_exists($file)) {
    header('Content-Description: File Transfer');
   // header('Content-Type: application/octet-stream');
    header('Cache-Control: public'); // needed for i.e.
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    //header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
                        ob_end_clean();
    flush();
    readfile($file);
    exit;
}
else {
            die('Error: File not found.');
        }
</code></pre>
