Re: PDF: error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/5/07, Mário Gamito <gamito@xxxxxxxxx> wrote:
Hi,

I've managed to make the PDF download system work.

But when it opens in acrobat reader, i get the error you can see in:
http://www.gamito.org/fucked-pdf-2.jpg

The code follows my signature.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito
--

<?php

session_start();

if (isset($_SESSION['email'])) {
 $error = false;
 if (isset($_GET['file'])) {
  $file = basename($_GET['file']);
  $full = '/var/www/testudio.pdf';
  if (!is_readable($full))
   $error = "Invalid filename.";
  } else {
   $error = "No filename given.";
 }

 header('Content-type: application/pdf');
 header("Content-Length: " . filesize($data));
 header('Content-disposition: attachment; filename="testudio.pdf"');
 readfile("testudio.pdf");
 }
?>

Where did you get the $data variable?
as filesize($data) would return false here, and that's not a good
value for the Content-Length header :)

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux