<p>I gave up my project to dynamically upload assets through matrix field dropdown values where the asset field is outside of the matrix field.
I actually just wanted to save assets in a logical structure.
I now save my craft commerce assets like this: product category/manufacturer/productionyear</p>

<pre><code>{{ object.categoryFieldHandle.first.slug }}/{{ object.dropdownFieldHandle }}/{{ object.dropdownFieldHandle }}
</code></pre>

<p>Maybe this helps someone.</p>

<p>@Brad Bell thanks for helping.</p>

CC BY-SA 3.0
2018-02-09T12:49:09.010Z
2018-02-09T12:49:09.010Z
TomS
<p>If you have an Asset field outside of Matrix and you want to set its "Upload Location" to be a dynamic value of Dropdown field inside of a separate Matrix field, something like this should work:</p>

<pre><code>{{ object.matrixFieldHandle.type('matribBlockHandleTheFieldLivesIn').first().dropdownFieldHandle.value }}
</code></pre>

CC BY-SA 3.0
2018-02-05T21:00:58.457Z
Thank you Brad, i tried this and it didn't work. That's why i'm not sure if i asked my question properly. The asset field is not in the matrix field, just the dropdown field is in a matrix field. My intention was to dynamically upload the assets sorted by manufacturer.  And because there are a lot of different manufacturer for different product types i wanted to choose them per matrix field where each blocktype is a product type with a dropdown field for the manufacturers. Is that possible?
TomS
CC BY-SA 3.0
2018-02-05T23:09:16.740Z
Ahh... I misunderstood, I think.  The Asset field is not in a Matrix field, just the dropdown. What's the name of the Matrix block the dropdown field lives in?  And is all of this in the context of a Commerce product?  And if so, does it have variants enabled?
Brad Bell
CC BY-SA 3.0
2018-02-06T10:34:07.150Z
Yes, the asset field is not in a Matrix field. The name of the matrix block where the dropdown field lives in is "manufacturerMountainbikes". The Matrix field "manufacturer" lives in the product field layout of a commerce product type. Yes i have variants enabled for color, framesize.
TomS
CC BY-SA 3.0
2018-02-07T02:22:19.180Z
Updated the answer... hope that helps.
Brad Bell
CC BY-SA 3.0
2018-02-02T23:05:37.977Z
2018-02-07T02:21:57.173Z
2018-02-07T02:21:57.173Z
Brad Bell
<p>I have a asset field where I would like to save the images in dynamic folders.
The upload folder should be parsed for the Dropdown field values in a Matrix field.</p>

<p>For a normal Dropdown field it works with </p>

<pre><code>{{ object.dropdownFieldHandle }} 
</code></pre>

<p>but for a Dropdown field in a Matrix field i can't get it working.</p>

<p>Any help is very appreciated. Thank you in advance.</p>

<assets><plugin-craftcommerce><upload><subfolder>
Dynamic asset subfolder path for Craft Commerce
# Dynamic asset subfolder path for Craft Commerce

(Asked by: username_0 on 2018-02-02)

I have a asset field where I would like to save the images in dynamic folders.
The upload folder should be parsed for the Dropdown field values in a Matrix field.
For a normal Dropdown field it works with 
{{ object.dropdownFieldHandle }} 

but for a Dropdown field in a Matrix field i can't get it working.
Any help is very appreciated. Thank you in advance.

**Tags:** assets, plugin-craftcommerce, upload, subfolder


---

## 2 answers

### Answer by username_0 on 2018-02-09. Score: 1 | Accepted answer

I gave up my project to dynamically upload assets through matrix field dropdown values where the asset field is outside of the matrix field.
I actually just wanted to save assets in a logical structure.
I now save my craft commerce assets like this: product category/manufacturer/productionyear
{{ object.categoryFieldHandle.first.slug }}/{{ object.dropdownFieldHandle }}/{{ object.dropdownFieldHandle }}

Maybe this helps someone.
@username_1 thanks for helping.


---

### Answer by username_1 on 2018-02-02. Score: 2

If you have an Asset field outside of Matrix and you want to set its "Upload Location" to be a dynamic value of Dropdown field inside of a separate Matrix field, something like this should work:
{{ object.matrixFieldHandle.type('matribBlockHandleTheFieldLivesIn').first().dropdownFieldHandle.value }}

> **Comments:**
> **username_0**: Thank you Brad, i tried this and it didn't work. That's why i'm not sure if i asked my question properly. The asset field is not in the matrix field, just the dropdown field is in a matrix field. My intention was to dynamically upload the assets sorted by manufacturer.  And because there are a lot of different manufacturer for different product types i wanted to choose them per matrix field where each blocktype is a product type with a dropdown field for the manufacturers. Is that possible?  
> **username_1**: Ahh... I misunderstood, I think.  The Asset field is not in a Matrix field, just the dropdown. What's the name of the Matrix block the dropdown field lives in?  And is all of this in the context of a Commerce product?  And if so, does it have variants enabled?  
> **username_0**: Yes, the asset field is not in a Matrix field. The name of the matrix block where the dropdown field lives in is "manufacturerMountainbikes". The Matrix field "manufacturer" lives in the product field layout of a commerce product type. Yes i have variants enabled for color, framesize.  
> **username_1**: Updated the answer... hope that helps.  

---

