$fileRelativePath = 'fileadmin/myfile.txt'; $absolutePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fileRelativePath); echo $absolutePath;
$fileRelativePath = 'fileadmin/myfile.txt'; $absolutePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($fileRelativePath); if (file_exists($absolutePath)) { // Do something if the file exists } else { // Do something else if the file doesn't exist }In this example, the file path "fileadmin/myfile.txt" is passed to the getFileAbsFileName() method to get the absolute path to the file. The file_exists() function is then used to check if the file exists, and execute some code accordingly. The GeneralUtility class and its methods are part of the TYPO3 CMS Core Utility package library.