PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
sublevel4
Forum Commoner
Posts: 33 Joined: Wed May 29, 2002 2:14 pm
Contact:
Post
by sublevel4 » Tue Oct 22, 2002 7:54 pm
if i have file how do i rename it but keep the same file extension
such as image.jpg -> 24039.jpg
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Oct 22, 2002 8:08 pm
Code: Select all
<?php
$filename = 'image.jpeg';
$newname = '12345'.substr($filename, strrpos($filename,'.'));
echo $newname;
?>
sublevel4
Forum Commoner
Posts: 33 Joined: Wed May 29, 2002 2:14 pm
Contact:
Post
by sublevel4 » Wed Oct 23, 2002 1:14 pm
Cool. Thanks for the help. That is exactly what i needed.