note 26051 added to function.header
| From: | a_alper at yahoo dot com | Date: | Wed, 16 Oct 2002 11:48:29 +0000 |
| Subject: | note 26051 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38155@lists.php.net to get a copy of this message | ||
Well, I had a slightly different problem. I wanted a page to open in ms word. Problem was when I
used the following:
header("Content-type: application/x-msword");
It would open in textpad, which I have associated to open documents of type .php
Not what I wanted. What I DID want was for the document to open onscreen in word. The webserver
was, of course, giving the filename of the code page on the net, in this case labels.php and the
resultant output was being associated with textpad due to the .php extension, even though the
encoding type was x-msword.''
The fix was quite simple
header("Content-type: application/x-msword");
header("Content-Disposition: filename="labels.doc");
This solved the problem nicely. Without attachment or other declarations, the page opens properly in
word as was the original intent. No download box is generated and word is the application invoked.
--
http://www.php.net/manual/en/function.header.php
http://master.php.net/manage/user-notes.php?action=edit+26051
http://master.php.net/manage/user-notes.php?action=delete+26051
http://master.php.net/manage/user-notes.php?action=reject+26051