I added a Gallery section to my site.yml file so I can upload images I want to use, but when I’m editing a sub-page and have a “files” field defined, it says I don’t have anything to select.
Is there a way to share any files uploaded to a global gallery to all sub page files fields?
Yes, you have to query the site files in your field
fields:
myimagefield:
type: files
query: site.images
upload:
# optional upload options, you probably want to either prevent this
# or upload to the site
See the docs: https://getkirby.com/docs/reference/panel/fields/files#upload-options
Without a query, the files field defaults to the current page’s files.
1 Like
@texnixe - ok that worked and solved my initial problem. No matter what you’re being paid for this, it should be more. Thank you so much for the help.
Your reply gave me a follow-up question though: Can I set a files field to allow for in-context uploading? I tried a few things from the docs, but I can’t seem to make it work.
This is what I have in my blueprint:
featureOneIcon:
label: Icon
type: files
query: site.images
empty: Select an icon
uploads: files-upload
multiple: false
width: 1/4
layout: list
What do you mean exactly?
More sold licenses = more money for everyone
1 Like
I don’t think I understand the way images work. I have two instances of a “files” type field in the panel. On one I can upload images:
sections:
gallery:
headline: Images
type: files
layout: list
But on this one, I can only select images that have been uploaded:
clients:
label: Client Logos
type: files
empty: Select some client logos you want to show off.
multiple: true
layout: cards
Files section allow you to upload files. Nothing is stored in the content file.
A files field is basically a select field, that is, you can select images (which ones you define in the query) that have already been uploaded. The selected file id(s) are stored in the content file.
However, you can also upload files via the files field (if you click on “Add”, you can choose between selecting and uploading). If you do not set the upload
property, you upload to the current page, like in your clients
example.
If you want to upload to another page, you can set the upload
property like this:
upload:
parent: site # upload destination
You can also assign a template to those uploaded files:
upload:
parent: site # upload destination
template: some-template
Ok - wow. I need to figure out what I’m doing wrong. That’s exactly how I hoped it would work (go figured that it’s supposed to)…
I have this in a blueprint:
fields:
featureTwoIcon:
label: Icon
type: files
query: site.images
empty: Select an icon
uploads: true
multiple: false
width: 1/4
layout: list
upload: true
parent: site
But this is how it looks in my panel. I cannot for the life of me get the “Add” action to show up with the “Select” action on a files field:
Remove true
after upload
(never put anything after a property key if there are sub-properties
fields:
featureTwoIcon:
label: Icon
type: files
query: site.images
empty: Select an icon
uploads: true
multiple: false
width: 1/4
layout: list
upload:
parent: site
But what is your Kirby version? Files uploads were added with v3.2.0, current version is 3.2.3.
1 Like
FML. I’ve been using 3.1.4.
Is there an easy way to update my version without overriding my current site work?
Replace the kirby
folder. Clear the cache and you should also clear stuff in the media
folder.
1 Like
I don’t know how many times I’m going to say I love you while I’m working on this project, but it’s going to be a high number. Prepare yourself. (thank you!!)
You’re welcome 
If we all loved each other much more, the world would be a better place.
1 Like