Re: Problems downloading a PDF

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

 



Hi,

that's what I said before. you echo out some html before the file
headers. that will never work.
remove the echo statement on line 14 and you should be okay
But i need the line

echo "<a href=\"products-testudio.php?file=testudio.pdf\"", " rel=\"external\">Download TESTUDIO flyer</a>";

to display the link for download!!!

How can i sove this puzzle ?

Full code follows my signature.

Thanks for all your help guys.

Warm Regards,
--
:wq! Mário Gamito
--
<?php
 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.";
     }
     if ($error) {
      echo "<a href=\"products-testudio.php?file=testudio.pdf\"",
      " rel=\"external\">Download TESTUDIO flyer</a>";
      exit;
      }
      header('Content-type: application/pdf');
      header("Content-Length: " . filesize($full));
header('Content-disposition: attachment; filename="testudio.pdf"');
      readfile($full);
      exit;
      } else {
        echo "Please, <a href=\"login.php\">login</a> to download the PDF";
     }
?>

--
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