[PHP] Problems with headers and downloading file

2004-11-29 Thread Christian Johansson
Hello.

 

I have a problem with downloads with the use of header()

I have this code at the start at the download site:

 

Header(Content-Type: application/download);

Header(Content-Disposition: attachment; filename=export.txt);

 

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.

Is there some way to take control on what should be written to the file?

I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.

Anyone who can help me?

 

I can't store a file on the server, and then download it, because of some
government rules.

 

 

 

Regards

 

Christian Johansson

 



Re: [PHP] Problems with headers and downloading file

2004-11-29 Thread John Nichel
Christian Johansson wrote:
Hello.
 

I have a problem with downloads with the use of header()
I have this code at the start at the download site:
 

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

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.
Is there some way to take control on what should be written to the file?
I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.
Anyone who can help me?
 

I can't store a file on the server, and then download it, because of some
government rules.
http://us4.php.net/striptags
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problems with headers and downloading file

2004-11-29 Thread David Dickson
Christian Johansson wrote:
I have a problem with downloads with the use of header()
I have this code at the start at the download site:
 
Header(Content-Type: application/download); 
Header(Content-Disposition: attachment; filename=export.txt);  

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.
Is there some way to take control on what should be written to the file?
I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.
Christian Johansson
Anything you echo after sending the headers will be inserted into the 
downloaded file. For example:

?php
header(Content-Type: application/download);
header(Content-Disposition: attachment; filename=export.txt);
echo This is the first line\n;
echo This is the second line.;
?
Will cause the users browser to download a text document that contains 
two lines of text. All you need to do is write your php code after the 
headers that generates your text file contents.

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