Page 1 of 1

renaming

Posted: Tue Oct 22, 2002 7:54 pm
by sublevel4
if i have file how do i rename it but keep the same file extension
such as image.jpg -> 24039.jpg

Posted: Tue Oct 22, 2002 8:08 pm
by volka

Code: Select all

<?php
$filename = 'image.jpeg';
$newname = '12345'.substr($filename, strrpos($filename,'.'));
echo $newname;
?>

Posted: Wed Oct 23, 2002 1:14 pm
by sublevel4
Cool. Thanks for the help. That is exactly what i needed.