I do:
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="the.pdf"');
header('Content-Length: ' . filesize($file));
@readfile($file);
and it works great. PDF opens in a browser.
Is it possible to do if-then-else earlier? I tried and I get raw PDF
%PDF-1.2 9 0 obj << /Type/Font /Subtype/Type1 /Name/F1 /FontDescriptor 8 0
Why does if-then-else change headers?
thank.
source
share