$tempFilePath = '/path/to/temporary/file'; \TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($tempFilePath);
$tempFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempPath, 'tmp'); foreach ($tempFiles as $file) { \TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($file); }This code snippet shows how to use the unlink_tempfile method as part of a larger script that deletes multiple temporary files. The script uses the getFilesInDir method to retrieve an array of all files in the specified directory that have a "tmp" extension. It then loops over each file and calls unlink_tempfile to safely delete it. The unlink_tempfile method is part of the TYPO3 CMS core and is contained in the GeneralUtility class. It is located in the "TYPO3\CMS\Core\Utility" namespace and can be found in the "typo3/sysext/core/Classes/Utility/GeneralUtility.php" file.