Re: Header's download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello.

I use:

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.

download.php are containing the headers.

All the export data are written to the file, but also HTML\JAVA.

How can I get around this problem?

I would be very happy if someone has a solution.

 

Regards

Christian Johansson

The solution:

Use ob_clean()to emty the buffer, Before you use the headers: 

ob_clean();
Header("Content-Type: application/download"); 
Header("Content-Disposition: attachment; filename=export.txt");

http://no2.php.net/manual/en/function.ob-clean.php

That's it!

Regards

Christian Johansson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux