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 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. 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! 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. 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"? 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. 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. Link to comment https://forums.phpfreaks.com/topic/277456-generate-readonly-word-doc/#findComment-1427343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.