Posted by rog on 01/12/07 18:45
Thanks Rik!
That does the job nicely!
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:973d4$45a7d475$8259c69c$28059@news1.tudelft.nl...
> rog wrote:
>> I have a script that produces a report and I want to give my clients
>> the option to download the report as a text file.
>>
>> Currently, the report page displays the report in the browser but has
>> an option to 'Download as File' which, when clicked
>> 1) resubmits the page
>> 2) writes the report data to a text file called "ReportAllInfo.txt"
>> (this seems to work fine)
>> 3)appends some headers and starts the download.
>>
>> code snippet:
>>
>> function SendFile()
>> {
>> global $filename;
>> header('Content-Type: application/octet-stream');
>> header('Content-Disposition: attachment;
>> filename="ReportAllInfo.txt"');
>>
>> // load the file to send:
>> readfile("ReportAllInfo.txt");
>> }
>
> function SendFile()
> {
> global $filename;
> header('Content-Type: application/octet-stream');
> header('Content-Disposition: attachment;
> filename="ReportAllInfo.txt"');
>
> // load the file to send:
> readfile("ReportAllInfo.txt");
> //stop processing
> exit;
> }
> --
> Rik Wasmus
>
>
[Back to original message]
|