Re: Displaying files
| From: | Stut | Date: | Thu, 14 Aug 2008 20:10:43 +0000 |
| Subject: | Re: Displaying files | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278086@lists.php.net to get a copy of this message | ||
On 14 Aug 2008, at 21:06, Dan Shirah wrote:
You need to know the mime type for the file you're serving. Call header('Content-Type: x/y'); where x/y is the mime type. Then call readfile('/path/to/file/on/server'); to output the file to the browser. -Stut -- http://stut.net/Who needs PHP... :)You're killin' me, Jim! :) I need to open the file from the server, using PHP. I already know how to open it using HTML and Javascript, but those methods cannot be used for this section of my application. I need to call and open the document in the browser window using PHP. Example: If I was going to do it with Javascript I would just use something simple like this; function open() { window.open('open.php'); } Or, if I was going to use HTML I would use something simlar to what you posted. How can I achieve that same functionality using only PHP? Or is it not possible?The following will open a new browser window and load the href in it. <a href="http://examples.com/123.xls" target="_blank">Open It!!!</a> If that isn't what you are looking for, please give a little more details.