Hello Richard. I totally agree with you. And I have tried to comment this to my employer. But as a consultant, my short stay has one purpose. Make it work, and then leave us alone. We have employees who keep track of the spaghetti :-) This is a very good example, how not to design systems.. I will of course comment this in the code. Thanks for your comment. Regards Christian Fra: Richard Lynch [mailto:ceo@xxxxxxxxx] Sendt: 1. desember 2004 22:06 Til: php-general@xxxxxxxxxxxxx Emne: Re: Header's download Christian Johansson wrote: > Header("Content-Type: application/download"); > Header("Content-Disposition: attachment; filename=export.txt"); > > Then after this is done I know that I can write stuff to the file like > this: > > Echo "This will be a line in my file\n"; > > I am standing in a GUI containing frames. > > So I want to give an administrator the rights to choose what to export. > > My problem is that when I include the php file "download.php", the > HTML\JAVA code are written to the file. The root cause of this is that *somewhere* in your scripts and PHP and HTML, you are forcing PHP to send those headers and your HTML and JavaScript out before you send out the headers and/or the content. While output buffering may allow you to gather all that content, and then throw it away, and then you can send your download... Wouldn't it make more sense to re-structure your code so that none of that crap (HTML and JavaScript) is being parsed by PHP? What if someday you decide to do something more interesting in PHP in the code that does the HTML and JavaScript output? Your downloads will maybe stop working, or you'll be executing the PHP script, but not even realizing it, because all the HTML and JavaScript output is thrown away, so you never "see" it, so you don't remember it's there... This is going to take a bit more work than just throwing in an ob_start() and whatever you call to throw away the output buffer, but you'll have cleaner and more clear code in the end. Up to you, really, as you're probably the one that has to maintain it... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php