$filename = "example/file.png"; $denyPattern = "/\.(php|pl|py)$/i"; // deny .php, .pl, and .py extensions if (GeneralUtility::verifyFilenameAgainstDenyPattern($filename, $denyPattern)) { echo "Filename is allowed."; } else { echo "Filename is not allowed."; }
$filename = "example.php"; $denyPattern = "/\.(php|pl|py)$/i"; // deny .php, .pl, and .py extensions if (GeneralUtility::verifyFilenameAgainstDenyPattern($filename, $denyPattern)) { echo "Filename is allowed."; } else { echo "Filename is not allowed."; }In this example, the verifyFilenameAgainstDenyPattern method checks if "example.php" contains .php, .pl, or .py extensions. Since the filename does contain .php, it returns false and prints "Filename is not allowed." The GeneralUtility verifyFilenameAgainstDenyPattern method is part of the TYPO3\CMS\Core\Utility\ class library.