$fileRef = 'fileadmin/images/pic.jpg'; $parts = GeneralUtility::split_fileref($fileRef); // Output the file name (pic.jpg) echo $parts['file'];
$fileRef = 'fileadmin/documents/report.docx'; $parts = GeneralUtility::split_fileref($fileRef, true); // Output the file extension (docx) echo $parts['fileExtension'];In this example, the boolean parameter is set to true, so the function returns an associative array containing the file path, file name, and file extension. The file extension is then output to the screen using array notation. The split_fileref function is part of the TYPO3 CMS Core library, which is included with the application.