web 2.0

How to use PHP & Rename() Rename File

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

  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. $flgRename = rename("shotdev/my.txt""shotdev/my_bak.txt");  
  8. if($flgRename)  
  9. {  
  10. echo "File rename.";  
  11. }  
  12. else  
  13. {  
  14. echo "Cannot rename file.";  
  15. }  
  16. ?>  
  17. </body>  
  18. </html>  

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_rename_file.php

Screenshot

PHP Rename File
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.