Re: Problems downloading a PDF

From: Date: Wed, 04 Apr 2007 13:23:08 +0000
Subject: Re: Problems downloading a PDF
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-252036@lists.php.net to get a copy of this message
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"; } ?>

« previous php.general (#252036) next »