Re: [PHP] Problems with header()
El Sáb 18 Jun 2005 01:38, Tom Rogers escribió: > > Here is a script I use to send pdfs which also handles caching > information. It may just be you are missing the content-length header? [snip] > header("Accept-Ranges: bytes"); > header('Cache-Control: no-cache, must-revalidate'); > header("Content-type: application/pdf"); > header("Content-Length: $len"); > readfile($filename); Excelent! The Content-length did it. The only thing I don't understand is that whenever I put the header("Accept-Ranges: bytes") it stops sending the PDF file. I comment out that line and everything works like a charme. Thank you! -- 10:06:43 up 11 days, 21:53, 1 user, load average: 2.32, 1.81, 1.35 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with header()
Hi, Saturday, June 18, 2005, 7:55:10 AM, you wrote: MM> I have to send a PDF file after a submit on a form. The PDF is well created, MM> and I'm sending it to the client with this: MM> $fpdfName = "/tmp/" . session_id() . ".pdf"; MM> // Vamos a mandar el PDF MM> header('Content-type: application/pdf'); MM> // El archivo se va a llamar libreDeuda.pdf MM> header('Content-Disposition: attachment; filename="libreDeuda' . MM>'.pdf"'); MM> // El PDF fuente va a ser $ftexName. MM> readfile($fpdfName); MM> The problem is that the PDF file that is sent is corrupted for acroread (xpdf MM> reads it like a charme), because, after the end of file (%%EOF) of PDF there MM> is an HTML page add to the file. MM> Is there anyway I can solve this? Is the sintaxis I used for sending a file MM> correct? Here is a script I use to send pdfs which also handles caching information. It may just be you are missing the content-length header? http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems with header
It looks like your trying to do something before redirecting the user. Try the below near the end of your script so everything completes before redirecting them. Echo "; Bronson_AT_udatasystems.com -Original Message- From: Carlos Alberto Pinto Hurtado [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Problems with header I'm use header("Location: http://www.ica.gov.co/contratacion/RObs_borradores?control=1";); but the answer is Warning Cannont add header information - headers already send by (output started at G:\Intranet\common\mail.php:36) in G:\Intranet\common\mail.php on line 37 Carlos Alberto Pinto Hurtado IT ICA (57 1) 2322181 (57 1) 2324698 Movil.(57 3) 310 6184251 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with header
Plainly put, you've already sent headers. Wheather it be an tag, a plain character, or just a space. Check line 37 and see what it is... - Original Message - From: "Carlos Alberto Pinto Hurtado" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 06, 2002 3:31 PM Subject: [PHP] Problems with header I'm use header("Location: http://www.ica.gov.co/contratacion/RObs_borradores?control=1";); but the answer is Warning Cannont add header information - headers already send by (output started at G:\Intranet\common\mail.php:36) in G:\Intranet\common\mail.php on line 37 Carlos Alberto Pinto Hurtado IT ICA (57 1) 2322181 (57 1) 2324698 Movil.(57 3) 310 6184251 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php