Much thanks.  This works but now it won't propmpt the download.  Once the
headers are sent anything going to std out is part of the download correct?
But this is just printing to the screen.  Any thoughts there?

<?
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=TEST.txt");
echo "LINE ONE".chr(13)."LINE TWO".chr(10)."LINE THREE";
?>

-Kevin

----- Original Message -----
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "'Kevin Stone'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, September 06, 2002 12:55 PM
Subject: RE: [PHP] Line Breaks in dynamic Download


> [snip]
> I have a script that allows clients to download their email lists from a
> database.  However I can not get the 'new line' characters (\n \r) to do
> their job in Notepad when the download is prompted and the file saved to
> disk.  I've simplified the problem with the code below.  Both \n and \r
> display as 'null' or undefined characters in Notepad.  What am I doing
> wrong?
>
> <?
> $file = "LINE ONE\nLINE TWO\rLINE THREE\n\r";
>
> header("Cache-control: private");
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=TEST.txt");
> echo $file;
> ?>
> [/snip]
>
> They're undefined characters. Notepad has this whole silly Windoze thing
> going on requiring a carriage return-linefeed at the end of each line you
> wish break. So you will either need to do \r\n or chr(13) chr(10) at each
> place you want a break (or a ^m). This happens to be an anomaly with
> Notepad, which unlike popular belief is not really a text editor, it just
> plays one on TV. Open your file in WordPAd, and prepare to be amazed.
>
> HTH!
>
> Jay
>
> *****************************************************
> * Texas PHP Developers Conf  Spring 2003            *
> * T Bar M Resort & Conference Center                *
> * New Braunfels, Texas                              *
> * Contact [EMAIL PROTECTED]       *
> *                                                   *
> * Want to present a paper or workshop? Contact now! *
> *****************************************************
>
>
>
> --
> 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

Reply via email to