Learning PHP and MySQL

Example 11-23 Renaming a file

<?php
   $file_name
="test.txt";
   
$new_file_name="production.txt";
   
$status=rename($file_name,$new_file_name);
   if  (
$status)  {
     
echo  ("Renamed  file.");
 
}
?>

The file has been renamed, as is demonstrated in the report from Example 11-29. The output is:

Renamed file.

Posted by on 08/19 at 08:41 AM

Next entry: Example 11-24 Prompting to upload a file

Previous entry: Example 11-22 Using file_exists, touch, and unlink together

<< Back to main