ID:               41491
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jeff at pointhere dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         HTTP related
 Operating System: Sun OS 5.10 (Solaris 10)
 PHP Version:      5.2.2
 New Comment:

.


Previous Comments:
------------------------------------------------------------------------

[2007-05-27 22:18:09] jeff at pointhere dot net

THAT DID IT!!  I then started experimenting with the code - I took out
all of the code that had any variables and it worked.  As soon as I
added them in it did not.  Then I changed the code to work with
apostrophes rather than quotes and put the variables back in with a
concatonation and it worked!  I hope this makes sense and leads to a fix
using the quotes and replacable variables. This code works as expected
and you can color me thrilled:

        
// Start sending the file
ob_start();
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Content-Transfer-Encoding: 7bit');
echo($cardprint_file);
ob_end_flush();

Thank you so much for pointing me down the path that led me to a
work-around and a working program!!!

   Jeff

------------------------------------------------------------------------

[2007-05-27 17:50:20] [EMAIL PROTECTED]

Can you try leaving header() calls with static parameters (no embeded 
variables) and see if you still get the extra chars?

------------------------------------------------------------------------

[2007-05-24 15:50:34] jeff at pointhere dot net

Description:
------------
When using the header() function to prepend a text file so that a user
can save a downloaded file, the resulting file has two extra characters
on the front of the file (hex '200A' - space and line-feed).  When
header() functions are removed, the file appears to load into the
browser correctly.

Reproduce code:
---------------
// Start sending the file
ob_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: text/plain");
header("Content-Length: " . $filesize);
header("Content-Disposition: attachment; filename=\"" . $filename .
"\"");
header("Content-Transfer-Encoding: 7bit");
echo($cardprint_file);
ob_end_flush();
exit;


Expected result:
----------------
The user's browser should open a window that asks to Open, Save or
Cancel the download.  When saving or opening the file the contents of
$cardprint_file should be the ONLY contents (the contents were verified
to be correct with the var_dump command).

Actual result:
--------------
The first two characters in the file (which translate to a blank line)
are an ASCII hex 20 (space) and an ASCII hex 0A (Line feed).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41491&edit=1

Reply via email to