public function extension($filename, $extensions = null)
    {
        $f = Loader::helper('file');
        $ext = strtolower($f->getExtension($filename));
        if (isset($extensions) && is_array($extensions) && count($extensions)) {
            $allowed_extensions = $extensions;
        } else { // pull from constants
            $extensions_string = strtolower(str_replace(array("*", "."), "", Config::get('concrete.upload.extensions')));
            $allowed_extensions = explode(";", $extensions_string);
        }

        return in_array($ext, $allowed_extensions);
    }