So, I am trying to use the rename function in php.
On the first try, if the destination folder is empty or does not contain directories with the same name as the original folder, the rename function works fine. However, if there is the same directory name, it fails. I want to just overwrite it, and I thought that rename () would be sufficient.
Here is my code:
public function move_temp_to_permanent($module_folder, $folders){ $bool = false; $module_folder_path = realpath(APPPATH . '../public/resources/temps/' . $module_folder); $module_folder_destination_path = $_SERVER['DOCUMENT_ROOT'] . '/ssmis/public/resources/photos/' . $module_folder . '/'; foreach($folders as $folder){ $bool = rename($module_folder_path . '/' . $folder, $module_folder_destination_path . $folder); } return $bool; }
There is an error in the above code:
Message: rename (C: \ XAMPP \ HTDOCS \ ssmis \ Public \ Resources \ Temps \ intruder / SJ-VIOL-2015-0002, C: / XAMPP / HTDOCS / ssmis / state / resources / photo / intruder / SJ-VIOL- 2015- 0002): Access denied. (code: 5)
I use CodeIgniter as a framework.
Thank you very much!
source share