In further developing the script I decided that rahter than just overwriting the existing instance of the file (which works fine) I'd rather kee a copy of the exisitng file before overwriting it.
It seems logical to rename the existing file before writing the new one, but I'm hitting up against permission problems.
Here is the code:
Code: Select all
110: if (file_exists('myfile.htm')) {
111: rename( 'myfile.htm', 'myfile.old' );
112: }
113:
114: $handle = fopen('myfile.htm', 'w');
115: fwrite($handle, $string);
116: fclose($handle);Warning: rename(myfile.htm,myfile.old): Permission denied in xxx.php on line 111
What am I missing?
Martin