Re: [PHP] Problems with header()
El Sb 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 - Martn Marqus| 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
[PHP] Problems with header()
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. Is there anyway I can solve this? Is the sintaxis I used for sending a file correct? -- 18:49:09 up 11 days, 6:35, 1 user, load average: 1.14, 1.26, 1.19 - Martn Marqus| 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? ?php $cache_time = false; $requested_time = false; $filename = /tmp/ . session_id() . .pdf; $len = filesize($filename); $mtime = filemtime($filename); $cache_time = gmdate('D, d M Y H:i:s', $mtime) . ' GMT'; header('Last-Modified: '.$cache_time); $rt = (empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))? false : $_SERVER['HTTP_IF_MODIFIED_SINCE']; if($rt) $requested_time = strtotime($rt); if($requested_time $cache_time){ if($requested_time == $cache_time){ Header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified'); exit; } } header(Accept-Ranges: bytes); header('Cache-Control: no-cache, must-revalidate'); header(Content-type: application/pdf); header(Content-Length: $len); readfile($filename); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
Re: [PHP] Problems with header
Plainly put, you've already sent headers. Wheather it be an html 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
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 meta http-equiv='Refresh' Content='0;URL=http://www.ica.gov.co/contratacion/RObs_borradores?contro l=1'; 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