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

Posted by Martνn Marquιs on 10/19/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
-----------------------------------------------------------------

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация