|
Posted by Maurice van 't Loo on 07/05/07 12:36
"rf" <rf@invalid.com> schreef in bericht
news:h94ji.3605$4A1.767@news-server.bigpond.net.au...
>
> "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.
>
It worked :-)
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=macros-cache.txt " );
header("Content-Transfer-Encoding: 8bit");
echo $bestand;
exit;
Thanks to your answer I could use the right words in Google :-p
Thanks for your fast answer :-)
Maurice
Navigation:
[Reply to this message]
|