Re: [PHP] [PHP-GENERAL] Serving docs from PHP
Alex James wrote: Beginner to PHP so I guess this could be a really simple answer. I have a page linking to a ms word doc however the doc doesn't open up in word within the sectioned part of the browser but displays a load of gobble e.g.. L N K7 ` ` ` ~ ? ? ? ? ? ? I can open a word doc in the browser from a html page just not a PHP file. I 've checked the Apache httpd conf file and the mine types which are fine But I think I missing something in the PHP conf files. Thanks for any help. Alex James Your php page has a link to the word document like this a href=word.docMy Document/a? Show some code. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [PHP-GENERAL] Serving docs from PHP
You probably want to add the mime type with 'header(Content-type: application/x-ms-word);'. Regards. -Gregory -Original Message- From: Alex James [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 7:57 AM To: [EMAIL PROTECTED] Subject: [PHP] [PHP-GENERAL] Serving docs from PHP Beginner to PHP so I guess this could be a really simple answer. I have a page linking to a ms word doc however the doc doesn't open up in word within the sectioned part of the browser but displays a load of gobble e.g.. ÐÏࡱá þ L N þÿÿÿK ÿÿÿì¥Á 7 ` ` ` ~ « « « I can open a word doc in the browser from a html page just not a PHP file. I 've checked the Apache httpd conf file and the mine types which are fine But I think I missing something in the PHP conf files. Thanks for any help. Alex James -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [PHP-GENERAL] Serving docs from PHP
John Nichel wrote: Your php page has a link to the word document like this a href=word.docMy Document/a? Show some code. Sorry Here is the link in menu6.php h3a href=index.php?m=6PK PATTERNS/a/h3 a href=index.php?m=6c=pkPatterns/MicroModel.docMicro models/a a href=index.php?m=6c=pkPatterns/test.htmlTest/a and getting called in here in index.php ?php $c = $_GET[c]; if ($c != ) { include($c); } else { include(content1.php); } ? Thanks Alex James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP-GENERAL] Serving docs from PHP
Alex James wrote: ?php $c = $_GET[c]; if ($c != ) { include($c); } else { include(content1.php); } ? The code is very unsafe, you include and execute any file, even remote if enabled in php.ini. You should use realpath() and substr() to check if the variable realy points to pkPatterns/ directory. Then check the file extension using pathinfo() and return apropriate Content-type header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP-GENERAL] Serving docs from PHP
Alex James wrote: John Nichel wrote: Your php page has a link to the word document like this a href=word.docMy Document/a? Show some code. Sorry Here is the link in menu6.php h3a href=index.php?m=6PK PATTERNS/a/h3 a href=index.php?m=6c=pkPatterns/MicroModel.docMicro models/a a href=index.php?m=6c=pkPatterns/test.htmlTest/a and getting called in here in index.php ?php $c = $_GET[c]; if ($c != ) { include($c); } else { include(content1.php); } ? Thanks Alex James On the page that you're trying to serve the Micro$oft Document (index.php), you're going to have to include the content type in the header, something like... header ( Content-type: application/msword ); See here... http://us4.php.net/manual/en/function.header.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [PHP-GENERAL] Serving docs from PHP
John Nichel wrote: On the page that you're trying to serve the Micro$oft Document (index.php), you're going to have to include the content type in the header, something like... header ( Content-type: application/msword ); See here... http://us4.php.net/manual/en/function.header.php Thanks John for your reply. I have tried putting a header before the html tag unfortunately all this does is output index.php in ms word format within the browser. As you've seen with some of the code supplied I want to simulate how a frameset works. So the sidebar (or menu=m) stays the same with the area defined for content changing upon menu options. However how can I open a word doc from a normal HTML file on apache and I can't with a PHP file ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP-GENERAL] Serving docs from PHP
Alex James wrote: John Nichel wrote: On the page that you're trying to serve the Micro$oft Document (index.php), you're going to have to include the content type in the header, something like... header ( Content-type: application/msword ); See here... http://us4.php.net/manual/en/function.header.php Thanks John for your reply. I have tried putting a header before the html tag unfortunately all this does is output index.php in ms word format within the browser. As you've seen with some of the code supplied I want to simulate how a frameset works. So the sidebar (or menu=m) stays the same with the area defined for content changing upon menu options. However how can I open a word doc from a normal HTML file on apache and I can't with a PHP file ? Okay, if you're going to include a MSWord document in a normal HTML file, how do you do thatwhat's your code to do it? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [PHP-GENERAL] Serving docs from PHP
Okay, if you're going to include a MSWord document in a normal HTML file, how do you do thatwhat's your code to do it? Ah...good point. Thought It would work like a frame. But now thinking about it I'm trying to embed a word doc in the html and guess because I not using some object or activeX control it won't work. Right I'm going to save the word docs as txt files and include ? Thanks Alex James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP-GENERAL] Serving docs from PHP
Alex James wrote: Okay, if you're going to include a MSWord document in a normal HTML file, how do you do thatwhat's your code to do it? Ah...good point. Thought It would work like a frame. But now thinking about it I'm trying to embed a word doc in the html and guess because I not using some object or activeX control it won't work. Right I'm going to save the word docs as txt files and include ? Thanks Alex James So you were previously doing this from a Windows server? If not, instead of trying to include the document with php's 'include', have php output the html code that works. When you call it as an include, Apache is going to treat it as the mime type of the document that called it (in this case, php). -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php