Rename Files in PHP

Renaming Files:
Like the copy() function, the rename() function just needs to know the original filename and a new filename. In this case, you’re just renaming the original, not copying it

$org_file = "e:/ashu.old";
$new_file = "e:/ashu.txt";
$success = rename($org_file, $new_file) or die("Unable to rename file");
$msg = "Rename $org_file to $new_file";
echo $msg;

No comments:

Post a Comment