|
Posted by rf on 07/05/07 10:58
"Maurice van 't Loo" <maurice@lievergeenspam.nl> wrote in message
news:468cc8f9$0$89292$dbd4d001@news.wanadoo.nl...
> Hi All,
>
> I have a string with text and want to be able to download the string as a
> file.
> I browsed php.net, but cant find any clou....
>
> I do NOT want to write the string to a file what you can download
> afterwards...
> The file might be .txt, .rtf or something like that.
>
> Can anyone help me with this?
Where does this string live?
If it lives in the php script that generates an HTML page then it is long
gone by the time a viewer of that HTML page requests, somehow, that the
string should be downloaded.
If it lives in the php script that executes as a result of a viewer
requesting, somehow, that the string be downloaded then simply output the
required headers that a browser would expect if, say, a .rtf file were to be
requested, followed by the contents of the string. The easyiest way to
determine what headers should be sent is to cause your browser to actually
download a file (something.rtf) and then examine the headers the server sent
using firebug or something. Never done this but that is the approach I would
take to make it happen.
--
Richard.
[Back to original message]
|