Reply to file download contains unwanted html

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация