Page 1 of 1

Can't figure out a path

Posted: Sun Jun 06, 2004 5:27 am
by philmill
I'm working on a project at the moment and I'm stuck with accessing .doc (MS Word documents) that are safely stored outside the scope of a web browser.

My server hierarchy is:

ROOT
|------www
|------secure
|------documents

Obviously I can access files within the www by http://www.domain.com/blah.php and files within secure (it's all setup properly) by https://secure.domain.com/blah.php. For security reasons I have put some Word documents into the documents folder so that you can't type a direct URL into the browser to retrieve the file.

I have some HTML documents within the documents folder and I can view these using the: ../../documents method but if you try this with Word documents I don't know how to setup the headers and it displays the file - but as "gobble-de-gook". Basically, raw data.

Is there any way I can specify that it's a MS Word document and display the file in a new window?

Any help/comments would be appreciated.

Cheers,

Phil

Posted: Sun Jun 06, 2004 8:42 am
by launchcode
If you are passing these Word docs to a PHP file for display in a browser, use the following: header("Content-type: application/msword"); - but be aware that your success rate will vary from client to client (some browsers will like this, some won't).