hi im currently working on a project that entails displaying od pdf files in the browser. So basically i store my pdf files under public/uploads/docs and try to display the pdf using my current code below. Unfortunately, it is always saying 'failed to load pdf' as you can see i also dumped the address i should be going to so here it is
string(59) "uploads/docs/2016-05-23-22-05-57-oth-Laravel Cheatsheet.pdf"
<?php
$pdf = 'uploads/docs/' . $list->filename;
dd($pdfurl);
header('Content-type: application/pdf');
// header('Content-Disposition: inline; filename="' . $pdf . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($pdf));
header('Accept-Ranges: bytes');
@readfile($pdf);
exit;
?>
any ideas what i am doing wrong? thanks in advance!
i just fixed my code and here is the working one :)
header('Content-type: application/pdf');
ob_clean();
flush();
readfile($pdfurl);
exit;