how to rename a picture allocated in a folder
$file_dir = realpath(); rename ("$file_dir/file/1.jpeg", "$file_dir/file/2.jpeg");
This is assuming your directory "file" is in your root web directory
i use the following code
rename ( "file/1.jpeg", "file/2.jpeg");
but the following error appear
Rename failed (No such file or directory) so plz help
so the script isnt seeing the file you are trying to rename...you can test this with something like: if(file_exists($filename)){ rename($filename1,$filename2); }else{ print "the path is wrong"; }
But you shouldn't have to map all the way to the root. Assuming you aren't doing anything terribly strange, you should be able to use the relative path just fine
I added the missing piece - see my first post