[Neos] Resolve Path of a file

Helmut Hummel helmut.hummel at typo3.org
Wed May 21 22:22:01 CEST 2014


Hi Carsten,

On 21.05.14 22:02, Carsten Bleicker wrote:

> Need to get the system path of a file located in public resources folder.
> But i can only find methods in resourcepublisher wich delivers me http// uri.
> need /foo/bar/baz.jpg
>
> Any hints?

You should never directly access resources by a file path, but always by 
suing a resource uri:

resource:://Package.Key/Public/file.txt

Thanks to a stream wrapper you can pass this as path to php file 
functions, e.g.:

file_get_contents('resource://TYPO3.Flow/Public/Error/Debugger.css')

HTH

Kind regards,
Helmut

-- 
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the Neos mailing list