* Thus wrote Scott Taylor: > > $fp = fopen($file, 'rb'); > // send the right headers > header("Content-Type: application/pdf"); > header("Content-Length: " . filesize($file)); > // dump the file and stop the script > fpassthru($fp); > > ... > > The reason for this is that somehow a hex 0A is added before the inital > %PDF-1.2 which marks the start of the PDF file causing some readers to > not recognize it as a PDF file. Is there anything in this code which > could possibly (always) cause an extra byte (0A) to be added before the > real start of the file? And no, the file is not corrupted (I've > already tried that) - this only happens when it goes through this > script, and not loaded directly as example.com/file.pdf.
The reason this can happen is if you are including a file that looks like this: <?php // content of includ file ?> EOF To find out where this is, turn error_reporting(E_ALL); and ini_set('display_errors', true); you'll get a message telling you that output was sent before the headers, and on what line the output started on. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php