Reply to Re: file download contains unwanted html

Your name:

Reply:


Posted by Rik on 01/12/07 18:36

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]


Удаленная работа для программистов  •  Как заработать на 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

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