Monday, 20 July 2015

Rename file directory in php

 PHP rename() function changed old directory to new directory If new name exists, it will be overwritten. Sometime wrongly uploaded file images or folder that time use this function easy to rename the new directory or image name.

rename('oldname','newname');



Sample code
<?php
rename("63H.jpg","h.jpg");
rename ("/folder/old.jpg", "/folder/new.jpg");
rename ("/uploads/old.pdf", "/uploads/new.pdf");
rename("foldername","newfolder");
?>

0 comments:

Post a Comment