You are here: Re: Problems with header() « PHP « IT news, forums, messages
Re: Problems with header()

Posted by Matthew Weier O'Phinney on 06/18/05 02:14

* Martín Marqués <martin@bugs.unl.edu.ar>:
> I have to send a PDF file after a submit on a form. The PDF is well created,
> and I'm sending it to the client with this:
>
> $fpdfName = "/tmp/" . session_id() . ".pdf";
>
> // Vamos a mandar el PDF
> header('Content-type: application/pdf');
> // El archivo se va a llamar libreDeuda.pdf
> header('Content-Disposition: attachment; filename="libreDeuda' .
> '.pdf"');
>
> // El PDF fuente va a ser $ftexName.
> readfile($fpdfName);
>
> The problem is that the PDF file that is sent is corrupted for acroread (xpdf
> reads it like a charme), because, after the end of file (%%EOF) of PDF there
> is an HTML page add to the file.

Likely what's happening is that there's extra output happening after
your readfile() call. Do an 'exit();' call right after it, and make sure
there's no whitespace after your closing PHP tag (or simply don't
include a closing PHP tag).

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация