patrickpdx Posted April 30, 2013 Share Posted April 30, 2013 Hi there, I am using WAMPSeerver, I can use the following code to generate WORD Doc on the server, but don't know how to make it "Read only". // put all the contents in the variable $message $fp = fopen($outputname, 'w+'); fwrite($fp, $message); fclose($fp); Please help if anyone know. Thanks. P Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/ Share on other sites More sharing options...
requinix Posted April 30, 2013 Share Posted April 30, 2013 Depends on the contents of $message, but I'm going to guess it's just HTML markup in which case the answer is probably no. Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427319 Share on other sites More sharing options...
patrickpdx Posted April 30, 2013 Author Share Posted April 30, 2013 Yes. it is HTML format contents. could you please let me know why the answer is no? and what's the way to do it? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427325 Share on other sites More sharing options...
requinix Posted April 30, 2013 Share Posted April 30, 2013 You're not actually outputting a Word doc. That's the only way you could get a read-only restriction. Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427327 Share on other sites More sharing options...
patrickpdx Posted April 30, 2013 Author Share Posted April 30, 2013 is there anyway to change the generated file's mode to "readonly"? Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427330 Share on other sites More sharing options...
patrickpdx Posted April 30, 2013 Author Share Posted April 30, 2013 tried using "chmod", got error. Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427331 Share on other sites More sharing options...
requinix Posted April 30, 2013 Share Posted April 30, 2013 If you want a read-only file, chmod 0444 for *nix and `attrib +r $file` on Windows. Quote Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427343 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.