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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php