I have a directory structure in place that I'd like to mimic in Craft. File uploads are first categorised by Year, then by month so the directory sturcture is like such

-- 2014
---- 01
---- 02
---- 03
---- 04
---- 05
---- 06

I've tried this but it still only uploads to the root folder I setup in sources


Am I using the wrong syntax? Do I need to use now | date ('Y') instead?

1 Answer 1


First you create an asset source uploads. Then you create an asset field and set its upload location subfolder to {postDate|date('Y')}/{postDate|date('m')}

When you edit an entry, any files you upload will go in the subfolder for the year and date. If you have selected Restrict uploads to a single folder? in the asset field, then only assets in that subfolder can be used.

  • Perfect thank you! I missed the Restrict uploads to a single folder? Jul 8, 2014 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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