Reply to header()

Your name:

Reply:


Posted by Mart�n Marqu�s on 06/21/66 11:13

I'm having a bit of a problem understanding how the header() sends the HTTP
headers.

Here's what I want to do:

1) Send a PDF file which will be printed in the client (the client will read
it and print it if he wants to.
2) Redirect to the main page of the aplication.

Now, what happens to me is that, if I do (1) without (2), the PDF file is
sent, but after printing and closing the PDF viewer, the browser stays in the
old page, something I don't want.
If I put (1) and (2) I don't get the PDF to print. I just redirects to the new
page.

Here is ths code (sorry about the comments on spanish :-) ):

// 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);

// Redirijimos todo.
header("Location: " . $_SERVER["PHP_SELF"] . "?" . session_name() .
"=" . session_id());



--
11:47:49 up 12 days, 20:16, 1 user, load average: 0.33, 0.30, 0.65
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

[Back to original 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

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