in reply to Changing file names as they are uploaded

This doesn't have the elegance of blakem's solution above, but it does let you define which extensions you will allow.
$ext = $1 if ($imagename =~ s/(\.jpg|gif|png)$//); $imagename =~ s/\W/_/g; $imagename .= $ext if ($ext);