public static function validateExtension($fileName, $allowedExtensions, $allowEmpty = true)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
        if (empty($extension)) {
            return $allowEmpty;
        }

        return in_array($extension, $allowedExtensions);
    }
public static function validateExtension($fileName, $allowedExtensions, $allowEmpty = true)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
        if (empty($extension)) {
            return $allowEmpty;
        }

        return in_array($extension, $allowedExtensions);
    }
public static function validateExtension ( $ fileName , $ allowedExtensions , $ allowEmpty = true ) { $ extension = strtolower ( pathinfo ( $ fileName , PATHINFO_EXTENSION ) ) ; if ( empty ( $ extension ) ) { return $ allowEmpty ; } return in_array ( $ extension , $ allowedExtensions ) ; }
Validates whether a file has an allowed extension.
@param string $fileName Specifies a path to validate
@param array $allowedExtensions A list of allowed file extensions
@param boolean $allowEmpty Determines whether the file extension could be empty.
@return boolean Returns true if the file extension is valid. Otherwise returns false.
Validates whether a file has an allowed extension .