Answers.Body: <p>If your desired URL is:</p>
  
  <pre><code>http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg
  </code></pre>
  
  <p>The the "Upload Location" for the setup you described would be something like:</p>
  
  <pre><code>towns/{owner.slug}/{albumName}/
  </code></pre>
  
  <p>I'm assuming <code>towns</code> is just hard-coded since you're referencing <code>town-slug</code> in the next segment.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T14:32:17.450Z
Answers.Text: 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.
Answers.UserDisplayName: Steven Thate
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T21:11:15.453Z
Answers.Text: Weird... something else must be going on. Tested locally and it worked.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-18T01:54:53.550Z
Answers.Text: 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!!
Answers.UserDisplayName: Steven Thate
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-07T00:36:46.510Z
Answers.LastActivityDate: 2018-02-07T00:36:46.510Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have a <code>towns</code> entry with a matrix field: <code>townAlbums</code>.</p>
  
  <p>This matrix field has just one block type: <code>photoAlbum</code>.</p>
  
  <p>This one block type has two basic text fields (the important one being <code>albumName</code> and one asset field for uploading images to the gallery: <code>albumPhotos</code>.</p>
  
  <p>I want the Default Upload Location for this matrix subfield <code>albumPhotos</code> to be dynamic, taking both the parent entry slug (slug of the town entry) and the name of the album: <code>albumName</code>. I'm not sure how to accomplish this.</p>
  
  <p><strong>Desired url:</strong></p>
  
  <p><code>http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg</code></p>
  
  <p>What should I be entering for my Default Upload Location?</p>
  
  <p>Thanks!</p>
  
Tags: <assets><matrix><image><upload>
Title: Default Upload Location needs matrix field and entry info... How?
ThreadText: # Default Upload Location needs matrix field and entry info... How?
  
  (Asked by: username_0 on 2018-02-06)
  
  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:**
  
  `http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg`
  
  What should I be entering for my Default Upload Location?
  
  Thanks!
  
  **Tags:** assets, matrix, image, upload
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-07. Score: 3 | Accepted answer
  
  If your desired URL is:
  
  ```
  http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg
  
  ```
  
  The the "Upload Location" for the setup you described would be something like:
  
  ```
  towns/{owner.slug}/{albumName}/
  
  ```
  
  I'm assuming `towns` is just hard-coded since you're referencing `town-slug` in the next segment.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_1**: Weird... something else must be going on. Tested locally and it worked.  
  > **username_0**: 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!!  
  
  ---
  
  