rename file php
rename('old_filename.txt', 'new_filename.txt');
php rename files in directory
<?php rename ("/folder/file.ext", "newfile.ext"); ?>
The above doesn't rename the file within the folder, as you might assume,
instead, it moves the file to whatever the PHP working directory is...
Chances are you'll not find it in your FTP tree.
Instead, use the following:
<?php rename ("/folder/file.ext", "/folder/newfile.ext"); ?>
php-rename-file
<?php
$oldname = 'readme.txt';
$newname = 'readme_v2.txt';
if (rename($oldname, $newname)) {
$message = sprintf(
'The file %s was renamed to %s successfully!',
$oldname,
$newname
);
} else {
$message = sprintf(
'There was an error renaming file %s',
$oldname
);
}
echo $message;
Code language: HTML, XML (xml)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us