I use the following script to break apart the name of an uploaded file and add in today's date before putting it back together.
//get todays date
$today = gmdate ("Y-m-d", mktime (1,1,1998));
//get length of filename to use when we need to break it apart
$filename_length = strlen ($file_name);
//extract the file extension, this does not include the fullstop
$ext = substr (strrchr ($file_name, "."), 1);
//find position of last fullstop, ie, the one before the file extension
$last_fullstop_position = strrpos ($file_name, ".");
//break apart the filename to remove the extension
$filename = substr ($userfile_name, 0, $fullstop_position);
//replace spaces with underscore
$filename[$i] = eregi_replace(" ", "_", $filename[$i]);
//add date and extension to filename
$filename[$i]= $filename[$i]."($today).$ext";