Posted by rog on 01/12/07 18:29
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");
}
This sequence causes the browser to display a Save As dialog and allows the
user to save the report data from ReportAllInfo.txt on his local machine.
The problem is that the downloaded report contains the html from
VolMan_ReportAll_CommaDelim.php appended at the bottom of the report.
I'd like to get rid of that appended html.
The report operation can be seen at
http://www.volmanager.com/Demo/DemoAdmin/VolMan_ReportAll_CommaDelim.php
Thanks,
Roger
Navigation:
[Reply to this message]
|