How to use PHP & Copy() Copy File Learn how to use the PHP to Rename File on web server and using function Rename()
ShotDev Focus:
- PHP & Rename File (Rename())
Example
php_rename_file.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? $flgRename = rename("shotdev/my.txt", "shotdev/my_bak.txt"); if($flgRename) { echo "File rename."; } else { echo "Cannot rename file."; } ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_rename_file.php
Screenshot