Rename file directory in php - Mostlikers

17 July, 2014

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");
?>


No comments:

Post a Comment