How can I strip out the file name without extension from a variable

Jun 7th 2010

This will strip the file extension from a file name even if it has a "." in it.
<?php

$fullFileName 
"myfile.exe";
$fileName preg_replace('/.[\d\w]*$/','',$fullFileName);

echo 
'<a href="'.$fullFileName.'">Please click here to download'.$fileName.'</a>';
?>