How to upload images to paths with folders for year and month

I would like to upload a set of images to a lot of databasedriven virtual pages ( > 400++).
After a serious amount of pages/images, the filesystem (for the images) really slows down.
Does anyone know, if it is however possible to upload them to a custom folder with subfolders of year/month/name.jpg but also read them all together in a files field??
Tnx for any hint!

something like:

  gallery:
    type: files
    uploads:
      parent: kirby.page("uploads").'/'.$currentyear.'/'.$currentmonth

Since you can use a query in the files field, that’s not a problem.

based on the requirement, that we have to upload images always to a page/subpage, i just set the files parent to page("uploads/".$year."/."$month) which is set/created by the page model.
that is working so far for the upload now.

if i set the query to the index of uploads, i get all the images on select too. unfortunately all among each other. thats a bid ugly when there is a really big amount of images.

  query: page('uploads').index.files
  uploads:
    parent: page.uploadPath

is it possible to set a query for the files-field to be able to click through years and month (similar to a pages-field), and then select an image from the year/month subpage?

No, that’s not possible out of the box.

Thx Sonja!
What could be outside the box? A custom files-field?

I think Sonja means by “out of the box” that individual solutions are not included in Kirby’s basic methods. :sunglasses:

Yes, that’s what I meant.

ok, thank you for your support!
the question is answered so far, that i set the upload-path in the page-model and create subpages for years and month on the fly inside the uploads-page and use the uploads-page-index as a query. will see how performant that is while select and if we have to do a custom files field :wink: