Displaying PDF to Browser with PHP not working

Viewed 3237

Using php's ability to call upon the browser to display a given PDF it doesn't work on my web host. But it works on my local xamp server with apache.

PHP:

    $title = $_GET['title'];
    $loc = $_GET['loc'];

    header("Content-type: application/pdf");
    header("Content-Disposition: inline; filename=".$title);
    @readfile($loc);

Expected Output: Supposed to be the PDF document being rendered like it does on my local web server.

Actual but unwanted output: %PDF-1.6 %���� 1638 0 obj <> endobj xref 1638 44 0000000016 00000 n ...

Can be seen here: http://neilau.me/view.php?title=business-studies-hsc-notes-2006.pdf&loc=pdf/criteria/business-studies/2006/business-studies-hsc-notes-2006.pdf

Is this fixed through changing something on my cpanel? As my code isn't faulty... It works on my local web server.

2 Answers
Related