<p>I guess it is a bug. Calling <code>getFolder</code> on an asset model returns an asset folder model, but it somehow looks like its <code>path</code> property always returns an empty string.</p>

<p>I tested this with local and S3 assets:</p>

<pre><code>{% set asset = craft.assets.id(217).first() %}
{% set folder = asset.getFolder() %}

{{ folder.path }}
{{ dump(folder) }}
</code></pre>

CC BY-SA 3.0
2016-01-27T01:12:03.840Z
2016-01-27T01:12:03.840Z
carlcs
<p>For long and complicated reasons, in order for this to work after Craft 2.5, your inner Asset field (the one that was restricting uploads to <code>{folder.path}</code>, will need to <code>{folder.path|trim('/')}</code> instead.</p>

CC BY-SA 3.0
2016-01-28T17:03:56.627Z
Glad that there's a workaround. Would this still be considered a bug?
Lindsey D
CC BY-SA 3.0
2016-01-28T18:44:49.377Z
Possibly?  Can't really think of a fix (clean or otherwise) for it at the moment, so I've vote to leave it open.  Pretty edge case, but someone else might run into it.
Brad Bell
CC BY-SA 3.0
2016-01-27T22:37:15.567Z
2016-01-27T22:37:15.567Z
Brad Bell
<p>I posed this question in the Craft Help Slack channel earlier but still don't have resolve.</p>

<p>Background on my field setup:</p>

<p>Entry
- Matrix
-- Image Block (matrix.imageBlock) (assets)
--- Mobile Image field (mobileField) (assets)</p>

<p>The image block field in the Matrix is using a restricted upload folder <code>{owner.slug}</code>; which is the entry slug (so its saved to <code>/uplaods/entrySlug/</code>). I also have a child asset field added to the image block to add a mobile specific image. Prior to Craft 2.5, using <code>{folder.path}</code> would put those images into the same <code>/uploads/entrySlug/</code>. Now when I "double click" the asset field to add the mobile image, <code>{folder.path}</code> returns <code>This field’s target subfolder path is invalid: {folder.path}</code>.</p>

<p>I was given a few ideas to pursue as it was thought that maybe the dynamic path had not resolved yet, but they didn't work.</p>

<p>I'm thinking that it does indeed revolve around dynamic paths, however, I can't seem to figure it out. All I'm looking to do is save the child asset field files to the same directory that all the other images go to (one image bank, so to speak, for the entire entry).</p>

CC BY-SA 3.0
2016-01-27T01:16:16.133Z
I voted to close as off-topic (a Craft bug). You should probably report it to P&T, so they can look into this.
carlcs
CC BY-SA 3.0
2016-01-27T03:04:38.253Z
Is `mobileField` inside of Matrix?  I can't tell from the description.
Brad Bell
CC BY-SA 3.0
2016-01-27T14:47:19.500Z
@BradBell it is only b/c it's added to the `imageBlock.` It is a standalone Assets field that I've added to the `imageBlock` Assets field which is a block in the Matrix.
Ryan Shrum
CC BY-SA 3.0
2016-01-27T20:11:00.923Z
So it's an Assets field, on an Assets field, inside of Matrix, right?
Brad Bell
CC BY-SA 3.0
2016-01-27T20:16:07.167Z
@BradBell That's right!
Ryan Shrum
<assets><matrix><field>
How do I set all Assets fields in entry to same directory?
# How do I set all Assets fields in entry to same directory?

(Asked by: username_0 on 2016-01-27)

I posed this question in the Craft Help Slack channel earlier but still don't have resolve.

Background on my field setup:

Entry
- Matrix
-- Image Block (matrix.imageBlock) (assets)
--- Mobile Image field (mobileField) (assets)

The image block field in the Matrix is using a restricted upload folder `{owner.slug}`; which is the entry slug (so its saved to `/uplaods/entrySlug/`). I also have a child asset field added to the image block to add a mobile specific image. Prior to Craft 2.5, using `{folder.path}` would put those images into the same `/uploads/entrySlug/`. Now when I "double click" the asset field to add the mobile image, `{folder.path}` returns `This field’s target subfolder path is invalid: {folder.path}`.

I was given a few ideas to pursue as it was thought that maybe the dynamic path had not resolved yet, but they didn't work.

I'm thinking that it does indeed revolve around dynamic paths, however, I can't seem to figure it out. All I'm looking to do is save the child asset field files to the same directory that all the other images go to (one image bank, so to speak, for the entire entry).

**Tags:** assets, matrix, field

> **Comments:**
> **username_1**: I voted to close as off-topic (a Craft bug). You should probably report it to P&T, so they can look into this.  
> **username_2**: Is `mobileField` inside of Matrix?  I can't tell from the description.  
> **username_0**: @BradBell it is only b/c it's added to the `imageBlock.` It is a standalone Assets field that I've added to the `imageBlock` Assets field which is a block in the Matrix.  
> **username_2**: So it's an Assets field, on an Assets field, inside of Matrix, right?  
> **username_0**: @BradBell That's right!  

---

## 2 answers

### Answer by username_2 on 2016-01-27. Score: 4 | Accepted answer

For long and complicated reasons, in order for this to work after Craft 2.5, your inner Asset field (the one that was restricting uploads to `{folder.path}`, will need to `{folder.path|trim('/')}` instead.

> **Comments:**
> **username_3**: Glad that there's a workaround. Would this still be considered a bug?  
> **username_2**: Possibly?  Can't really think of a fix (clean or otherwise) for it at the moment, so I've vote to leave it open.  Pretty edge case, but someone else might run into it.  

---

### Answer by username_1 on 2016-01-27. Score: 1

I guess it is a bug. Calling getFolder on an asset model returns an asset folder model, but it somehow looks like its path property always returns an empty string.
I tested this with local and S3 assets:
{% set asset = craft.assets.id(217).first() %}
{% set folder = asset.getFolder() %}

{{ folder.path }}
{{ dump(folder) }}


---

