What you want to do is separate the filename bit from the extension, append what you want to the filename, and then glue them back together. Like so:
PHP Code:
// assume uploaded file
$filename=$_FILES['myfile']['name'];
// get the position of the last (!) dot in the filename
$pos=strrpos($filename, '.')
// get the file name
$name=substr($filename, 0, $pos);
// get the extension
$ext=substr($filename, $pos + 1);
// set the new name
$newName=$name.'hth';
// glue back together
$newFilename=$newName.'.'.$ext;
Note that this uses $ext without the dot in the extension, which makes it easer if you want to check the extension later; 'jpg' is easier to read and type than '.jpg'
Bookmarks