I have a towns entry with a matrix field: townAlbums.

This matrix field has just one block type: photoAlbum.

This one block type has two basic text fields (the important one being albumName and one asset field for uploading images to the gallery: albumPhotos.

I want the Default Upload Location for this matrix subfield albumPhotos to be dynamic, taking both the parent entry slug (slug of the town entry) and the name of the album: albumName. I'm not sure how to accomplish this.

Desired url:


What should I be entering for my Default Upload Location?



If your desired URL is:


The the "Upload Location" for the setup you described would be something like:


I'm assuming towns is just hard-coded since you're referencing town-slug in the next segment.

| improve this answer | |
  • This did create the right directory structure, but the uploaded photos end up getting saved in the root uploads/ directory, not the towns/town-slug/album-name/ path it successfully created. – Steven Thate Feb 8 '18 at 14:32
  • Weird... something else must be going on. Tested locally and it worked. – Brad Bell Feb 8 '18 at 21:11
  • Not sure what has changed since. Maybe something in one of the recent Craft updates?? In any case, I just tried your suggestion again and can confirm it's working on my end now. Thanks!! – Steven Thate Mar 18 '18 at 1:54

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.