# Files field query is invalid

**URL:** <https://forum.getkirby.com/t/files-field-query-is-invalid/16497>\
**Category:** Questions\
**Tags:** v3\
**Created:** [November 30, 2019, 11:21am UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497 "2019-11-30T11:21:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeBen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/leben/32/6103_2.png) [@LeBen](https://forum.getkirby.com/u/LeBen)\
**Post date:** [November 30, 2019, 11:21am UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/1 "2019-11-30T11:21:51Z")

</div>

I have a field like this in my site blueprint:

```auto
openGraphImage:
  type: files
  multiple: false
  query: page.images
  required: true
  translate: false

```

The `query` here triggers the following error in the panel:

> Your query must return a set of files

However this query seems correct according to the Kirby docs.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [November 30, 2019, 12:47pm UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/2 "2019-11-30T12:47:12Z")

</div>

You dont need the query at all, the default is to show all the files on the page. Unless…do you have other file types on the page and you just want to show images in it?

---

<div class="post-metadata">

**Author:** ![LeBen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/leben/32/6103_2.png) [@LeBen](https://forum.getkirby.com/u/LeBen)\
**Post date:** [December 6, 2019, 3:05pm UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/3 "2019-12-06T15:05:01Z")

</div>

That’s the idea, I want to allow only images to be selected.

---

<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:** [December 6, 2019, 3:20pm UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/4 "2019-12-06T15:20:41Z")

</div>

If you want to restrict the type of images that can be uploaded to the page via this field, you have set the `upload` property with a template that contains an `accept` property.

> **[Files](https://getkirby.com/docs/reference/panel/fields/files#upload-options)**
>
> A files select field that allows to select one or multiple related files

---

<div class="post-metadata">

**Author:** ![LeBen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/leben/32/6103_2.png) [@LeBen](https://forum.getkirby.com/u/LeBen)\
**Post date:** [December 16, 2019, 9:17am UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/5 "2019-12-16T09:17:20Z")

</div>

I want to restrict the type of files from this page that can be attached to this field in particular. The code I shared is taken from the docs ([https://getkirby.com/docs/reference/panel/fields/files#querying-files\_\_limit-the-set-to-images](https://getkirby.com/docs/reference/panel/fields/files#querying-files__limit-the-set-to-images)) but doesn’t work.

Should I open a bug in Kirby repo or Docs repo? I’m not sure which one is supposed to be correct.

---

<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:** [December 16, 2019, 10:20am UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/6 "2019-12-16T10:20:30Z")

</div>

I can’t reproduce your issue or only partly.

With the above file field setting, I can only select images, not documents etc.

You can, however, upload other files if you don’t restrict this in the uploads option by setting a files template and

```auto
 uploads: 
    template: files-upload

```

inside this template, set the accept property.

However, without this setting–and that’s probably a bug–while other files are not selectable, a file uploaded that is not an image is immediately selected without Kirby complaining.

---

<div class="post-metadata">

**Author:** ![LeBen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/leben/32/6103_2.png) [@LeBen](https://forum.getkirby.com/u/LeBen)\
**Post date:** [December 18, 2019, 12:04pm UTC](https://forum.getkirby.com/t/files-field-query-is-invalid/16497/7 "2019-12-18T12:04:39Z")

</div>

I found the issue; I was querying `page.images` at the site level, it should have been `site.images` instead.

Thanks for your help!
