Re: PHP removing data...
| From: | Ernest E Vogelsinger | Date: | Sat, 08 Mar 2003 16:47:07 +0000 |
| Subject: | Re: PHP removing data... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138761@lists.php.net to get a copy of this message | ||
At 17:12 08.03.2003, Doug Coning said:
--------------------[snip]--------------------
>Hi all,
>
>I'm trying to save a text file from my server to a client machine through
>PHP and am using the following headers:
>
>header("Content-type: application/text");
>header("Content-Disposition: attachment; filename=variables.txt");
>
>The header does save a text file from the server to my desktop alright, but
>it strips everything in the text file. I have a file named variables.txt
>with nothing in it. I have uploaded a text file that does have test data in
>it. Furthermore, I set all the user rights in Unix to Read / Write/Execute
>but everytime PHP opens or saves it, it does so without any of the variables
>I've entered.
--------------------[snip]--------------------
Try to add the Content-length header and see if this resolves your problem:
header("Content-type: application/text");
header('Content-Disposition: attachment; filename="variables.txt"');
header('Content-Length: ' . strlen($contents));
I made a habit to send the "filename" part in double quotes - some user
agents seem to require this although it's not required by RFC (RFC822,
RFC2183). Since doing this it always works for me :)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/