use SilverStripe\Core\Director; $fileRelativePath = 'assets/example.txt'; $absolutePath = Director::getAbsFile($fileRelativePath); echo $absolutePath; // Output: /path/to/silverstripe/project/assets/example.txt
use SilverStripe\Core\Director; $fileRelativePath = 'mysubdirectory/example.txt'; $absolutePath = Director::getAbsFile($fileRelativePath); echo $absolutePath; // Output: /path/to/silverstripe/project/mysubdirectory/example.txtPackage/Library: The getAbsFile method is part of the SilverStripe framework's core Director class.