class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
$foo->file_dst_name $foo->file_dst_name_body $foo->file_dst_name_ext $foo->file_dst_path $foo->file_dst_pathname
You can read some class variables after calling $foo->process(). The following ones can be used to get the filename details: