PHP rename function does not working
You need to get your real path, for me real path /Applications/MAMP/htdocs/phptest
but you can define ABSPATH
like define('ABSPATH', dirname(__FILE__).'/');
Complete code:
error_reporting(1);
error_reporting('On');
define('ABSPATH', dirname(__FILE__).'/');
include 'includes/config.php'; // database configuration file
$file_name = "images800466507.jpg";
$currentPath = ABSPATH.'/TempImages/'.$file_name; // ( file permission : 777 )
$newPath = ABSPATH.'/ImagesNew/'.$file_name; // ( file permission : 755 )
if( rename($currentPath ,$newPath ) )
echo 'done';
else
echo 'not done';
I tested and it worked for me.