# Global and local files in "files" field

**URL:** <https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 7, 2020, 10:05am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167 "2020-02-07T10:05:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Puppet9](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/puppet9/32/6680_2.png) [@Puppet9](https://forum.getkirby.com/u/Puppet9)\
**Post date:** [February 7, 2020, 10:05am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/1 "2020-02-07T10:05:07Z")

</div>

Hello,

I would like to show global files uploaded via the site blueprint + local files uploaded on the current subpage. Showing files from site does work:

```
query: site.images

```

But how to add the images uploaded to the subpage folder?

Thank you!

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [February 7, 2020, 10:48am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/2 "2020-02-07T10:48:37Z")

</div>

afaik all core sections (files and pages) need one and only one parent object.

but maybe @texnixe plugin: [https://github.com/texnixe/k3-filesdisplay-section](https://github.com/texnixe/k3-filesdisplay-section)  
can handle having a collection object as a root (since her plugin is based on [one for pages](https://github.com/rasteiner/k3-pagesdisplay-section) that does allow this).

`query: kirby.collection('myfiles')`

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 7, 2020, 10:51am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/3 "2020-02-07T10:51:20Z")

</div>

> [@bnomei](#):
>
> but maybe @texnixe plugin: [GitHub - texnixe/k3-filesdisplay-section](https://github.com/texnixe/k3-filesdisplay-section)

But the plugin is a section, not a files field.

In a field you would use a query, anyway, not a parent.

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [February 7, 2020, 10:54am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/4 "2020-02-07T10:54:32Z")

</div>

another idea would be to override the images method in a pagemodel. in that a merged array could be returned. but i am not sure about this having side-effects like when trying to remove a file.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 7, 2020, 10:57am UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/5 "2020-02-07T10:57:13Z")

</div>

> [@bnomei](#):
>
> but i am not sure about this having side-effects like when trying to remove a file.

That will then have effects on the frontend as well, so I wouldn’t do it. Better use a general method, but it should actually be possible to use collections in a query, but I’m not sure how a collection behaves when trying to use the current page.

I’d go with a custom [page **method**](https://getkirby.com/docs/reference/plugins/extensions/page-methods) that combines the page’s files with the site’s files.

---

<div class="post-metadata">

**Author:** ![Puppet9](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/puppet9/32/6680_2.png) [@Puppet9](https://forum.getkirby.com/u/Puppet9)\
**Post date:** [February 7, 2020, 4:37pm UTC](https://forum.getkirby.com/t/global-and-local-files-in-files-field/17167/6 "2020-02-07T16:37:50Z")

</div>

I used a page method to combine the files like this

```
    'pageMethods' => [
        'combinedFiles' => function () {

            return $this->files()->add($this->site()->files());

        }
    ]

```

And then used the new function in my blueprint query:

```
query: page.combinedFiles

```

Thank you!
