<p>You do this by adding <code>{site.handle}</code> to the <strong>fields</strong> <em>upload location</em>. </p>

<p>This will create the subfolders like you mentioned. It will also create a <em>default</em> subfolder for the default site, but that's ok.</p>

<p><strong>Note:</strong> Make sure to rebuild your Asset Indexes in <em>Utilities > Asset Indexes</em> after you add the subfolder path. </p>

<p>That should ensure that they point to the subfolder next time you go to upload an image. I had trouble with it still pointing to the root volume directory, but that fixed it.</p>

<p>Also, all your current images will still work, but they will no longer show when adding/editing assets (As they are still in the root folder) You will need to copy these to the appropriate subfolder and rebuild your asset indexes (or upload again) if you want them to appear. <em>Don't delete them from the root folder until you have updated the entries that access them.</em></p>

<p>I haven't been able to find a way to dynamically change the volumes. As far as I know it is not possible, but using subfolders works well.</p>

CC BY-SA 4.0
2019-08-13T09:08:21.290Z
I read your answer and this seems like the exact same thing I want to do, but I can't figure out what you mean by `You do this by adding {site.handle} to the fields upload location.`. do I have to add some magic field to the assets in my volume?
jishi
CC BY-SA 4.0
2019-08-14T19:13:29.003Z
@jishi You create your volume with the base folder location.

It is when you create the **asset field** and point it to the asset volume that you add `{site.handle}` to the upload location to add the sub folder. 

For a seamless experience, I have been limiting all my asset fields to a single folder. If you allow multiple folders, it lists them with the sub folders shown.
MalTek
CC BY-SA 4.0
2019-06-30T17:41:42.533Z
2019-06-30T17:41:42.533Z
MalTek
<p>We've got a Craft 3 (3.1.25) multi-site setup with three sites:</p>

<ul>
<li>Corporate (default)</li>
<li>Brand A (brandA)</li>
<li>Brand B (brandB)</li>
</ul>

<p>For this install there's 3 users setup with the following access to the sites.</p>

<ul>
<li>User 1 (Admin - all sites)</li>
<li>User 2 (Brand A)</li>
<li>User 3 (Brand B)</li>
</ul>

<p>The site has an 'Images' asset volume (remote - S3) for images to be uploaded into.</p>

<p><strong>What we're trying to work out is how to make images uploaded into an asset volume specific to the site they relate to and make sure users can only see/edit images relating to the site they have access to.</strong></p>

<p>It would be even better we could store them like below:</p>

<pre><code>S3/images/brandA/
S3/images/brandB/
</code></pre>

<p>When you access the asset folder via the CP you can see the site switcher at the top - but when uploading via this area the assets are automatically appearing under all sites (when logged in as User 1).</p>

<p>This is especially important for the 'Products' section we've created that uses a 'Product Image' asset field that we've created. We want User 2 &amp; 3 to see only the images relating to the site that the entry they're editing is related to.</p>

<p>There is a similar question below but doesn't entirely answer how to achieve the above. 
<a href="https://craftcms.stackexchange.com/questions/27628/how-to-setup-assets-in-multi-site-where-each-site-should-have-its-own-assets?rq=1">How to setup assets in multi site where each site should have its own assets?</a></p>

<craft3><assets><users><multi-site>
Multi-site - Setup remote asset volume to store assets on a per site/folder basis
# Multi-site - Setup remote asset volume to store assets on a per site/folder basis

(Asked by: username_0 on 2019-05-02)

We've got a Craft 3 (3.1.25) multi-site setup with three sites:

Corporate (default)
Brand A (brandA)
Brand B (brandB)

For this install there's 3 users setup with the following access to the sites.

User 1 (Admin - all sites)
User 2 (Brand A)
User 3 (Brand B)

The site has an 'Images' asset volume (remote - S3) for images to be uploaded into.
What we're trying to work out is how to make images uploaded into an asset volume specific to the site they relate to and make sure users can only see/edit images relating to the site they have access to.
It would be even better we could store them like below:
S3/images/brandA/
S3/images/brandB/

When you access the asset folder via the CP you can see the site switcher at the top - but when uploading via this area the assets are automatically appearing under all sites (when logged in as User 1).
This is especially important for the 'Products' section we've created that uses a 'Product Image' asset field that we've created. We want User 2 & 3 to see only the images relating to the site that the entry they're editing is related to.
There is a similar question below but doesn't entirely answer how to achieve the above. 
How to setup assets in multi site where each site should have its own assets?

**Tags:** craft3, assets, users, multi-site


---

## 1 answers

### Answer by username_1 on 2019-06-30. Score: 2

You do this by adding `{site.handle}` to the **fields** *upload location*.

This will create the subfolders like you mentioned. It will also create a *default* subfolder for the default site, but that's ok.

**Note:** Make sure to rebuild your Asset Indexes in *Utilities > Asset Indexes* after you add the subfolder path.

That should ensure that they point to the subfolder next time you go to upload an image. I had trouble with it still pointing to the root volume directory, but that fixed it.

Also, all your current images will still work, but they will no longer show when adding/editing assets (As they are still in the root folder) You will need to copy these to the appropriate subfolder and rebuild your asset indexes (or upload again) if you want them to appear. *Don't delete them from the root folder until you have updated the entries that access them.*

I haven't been able to find a way to dynamically change the volumes. As far as I know it is not possible, but using subfolders works well.

> **Comments:**
> **username_2**: I read your answer and this seems like the exact same thing I want to do, but I can't figure out what you mean by `You do this by adding {site.handle} to the fields upload location.`. do I have to add some magic field to the assets in my volume?  
> **username_1**: @username_2 You create your volume with the base folder location.  It is when you create the **asset field** and point it to the asset volume that you add `{site.handle}` to the upload location to add the sub folder.   For a seamless experience, I have been limiting all my asset fields to a single folder. If you allow multiple folders, it lists them with the sub folders shown.  

---

