Page 1 of 1
Opening Word Document without it saving in Temp directory?
Posted: Thu Nov 16, 2006 4:02 am
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?
Posted: Thu Nov 16, 2006 4:44 am
by aaronhall
Are you talking about opening and saving it on the client side, or with PHP on the server side?
Posted: Thu Nov 16, 2006 6:53 pm
by Mr Tech
The server side... Is it possible?
Posted: Thu Nov 16, 2006 7:14 pm
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.
Posted: Thu Nov 16, 2006 7:26 pm
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.
Posted: Thu Nov 16, 2006 7:34 pm
by volka
I'm not quite sure what you're looking for. Maybe you're interested in WebDAV.
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
Posted: Thu Nov 16, 2006 7:43 pm
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.