Can't figure out a path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
philmill
Forum Newbie
Posts: 2
Joined: Thu Mar 04, 2004 5:48 pm
Location: Durham, UK
Contact:

Can't figure out a path

Post 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
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post 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).
Post Reply