public static function cleanFilename($filename)
    {
        return preg_replace(
            '/[^A-Za-z0-9_\-]/',
            '_',
            htmlentities(pathinfo($filename, PATHINFO_FILENAME))
        ) . '.' . preg_replace(
            '/[^A-Za-z0-9_\-]/',
            '_',
            htmlentities(pathinfo($filename, PATHINFO_EXTENSION))
        );
    }
public static function cleanFilename($filename)
    {
        return preg_replace(
            '/[^A-Za-z0-9_\-]/',
            '_',
            htmlentities(pathinfo($filename, PATHINFO_FILENAME))
        ) . '.' . preg_replace(
            '/[^A-Za-z0-9_\-]/',
            '_',
            htmlentities(pathinfo($filename, PATHINFO_EXTENSION))
        );
    }
public static function cleanFilename ( $ filename ) { return preg_replace ( '/[^A-Za-z0-9_\-]/' , '_' , htmlentities ( pathinfo ( $ filename , PATHINFO_FILENAME ) ) ) . '.' . preg_replace ( '/[^A-Za-z0-9_\-]/' , '_' , htmlentities ( pathinfo ( $ filename , PATHINFO_EXTENSION ) ) ) ; }
White list scrub of file name.

@param string $filename A filename to be cleaned of potentially troublesome characters.
@return string
White list scrub of file name .