Opening Word Document without it saving in Temp directory?

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
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Opening Word Document without it saving in Temp directory?

Post by Mr Tech »

Is it possible to open an exisiting Microsoft Word document using PHP without the browser saving the word document in a temp folder?

This is my code which doesn't open the original but mvoe it to a temp folder... When I save it, it doesn't overwrite the original:

Code: Select all

header('Content-Type: application/msword');
header("Content-Disposition: attachment; filename=\"".make_safe($root[value]."files/".$_GET[file])."\"");
readfile(make_safe($root[value]."files/".$_GET[file]));
Any ideas?
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Are you talking about opening and saving it on the client side, or with PHP on the server side?
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

The server side... Is it possible?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

meaning: you want to extract data or manipulate the document with a (server-sie) php script? You code snippet suggest otherwise.
Please elucidate.
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

Sorry if I'm a bit vague... I don't think my code above is correct so don't base it on that.

My script basically opens a word document, replaces some fields within the word document and then saves the document in a new folder with a new name. I then want to be able to open that word document, make changes to it and then save it to the server again.

At the moment I have on a local install on my PC. So if the above is not possible, is it possible on a local install of PHP?

That code I post is the code after the word document has been saved in a new folder on the server.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I'm not quite sure what you're looking for. Maybe you're interested in WebDAV.
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/844f5e01-4b9e-4dac-897e-2a0bb33f28af.mspx?mfr=true wrote:Microsoft Office products (Office 2000 and Office XP): Create, publish, edit, and save documents directly into a WebDAV directory through any application in Office 2000 or Office XP.
The article is about WebDAV and IIS but it's not limited to IIS, see e.g. http://httpd.apache.org/docs/2.2/mod/mod_dav.html
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

Are you saying you don't understand what I mean or you don't know how it would be done? I can try explain better if that is the case.
Post Reply