<p>I've ran into something similar, although it was using the entry ID. If you set the category and save the entry, and then upload an asset to that field on the entry does it save into the location you have set? </p>

<p>Also if the assets field is within a matrix you'll need to use <em>owner</em> </p>

<pre><code>{owner.galleryCategory.first.slug}
</code></pre>

CC BY-SA 3.0
2017-07-07T16:26:36.873Z
2017-07-07T16:26:36.873Z
Andy
<p>I'm building a gallery system and on the entry page I have fields for gallery category (category field) as well as gallery photos (assets field). When creating this entry, I would like to upload the assets field to something like:</p>

<p>images/galleries/category/slug</p>

<p>However, because the category is still being defined in the same entry as the assets are being uploaded, my images aren't put into a folder based on the category.</p>

<p>Is what I'm trying to do possible? What's the best way to approach it? I'm currently using this for my assets file path:</p>

<p>images/galleries/{galleryCategory.first.slug}/{slug}</p>

<assets><categories><entry><upload>
Upload assets to location based on category if entry isn't saved yet?
# Upload assets to location based on category if entry isn't saved yet?

(Asked by: username_0 on 2017-07-06)

I'm building a gallery system and on the entry page I have fields for gallery category (category field) as well as gallery photos (assets field). When creating this entry, I would like to upload the assets field to something like:

images/galleries/category/slug

However, because the category is still being defined in the same entry as the assets are being uploaded, my images aren't put into a folder based on the category.

Is what I'm trying to do possible? What's the best way to approach it? I'm currently using this for my assets file path:

images/galleries/{galleryCategory.first.slug}/{slug}

**Tags:** assets, categories, entry, upload


---

## 1 answers

### Answer by username_1 on 2017-07-07. Score: 2

I've ran into something similar, although it was using the entry ID. If you set the category and save the entry, and then upload an asset to that field on the entry does it save into the location you have set? 
Also if the assets field is within a matrix you'll need to use owner 
{owner.galleryCategory.first.slug}


---

