I'm reading through the Craft docs in relation to the AssetFileModel.

Looking at the getPath() method, this reads in theory that it should return the full path to the asset relative to the root, with any sub directories etc.


Yet this doesn't to appear to be the case, I seem to be getting /filename.ext

If however I was to use folderPath() this then provides the subfolder name configured in the relevant S3 asset source.


Is this correct? Is getPath() meant to behave this way with S3 asset sources?

1 Answer 1


Seems to be working as expected for me. I've got an Asset Source setup with an S3 bucket.

At the root of the bucket, there is a test1 folder and in it is a test2 folder... i.e. root/test1/test2/. From there, I put a test.jpg file inside of test2.

When I do this from a template (where ID is the Asset ID for test.jpg:

{% set image = craft.assets.id(13).first() %}

{{ image.getPath() }}

I get the expected:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.