File uploads don't apply file templates - after multisite conversion

Well, I’ve been at this all day, and I’m stuck…

I had a site working nicely with file sections in the Panel uploading files and applying file templates.

Then I split the site with a basic multisite setup. (Client needs a separate domain for regulatory reasons – it’s essentially all the same site.) I also updated from Kirby 3 to 4.1.0.

The panel doing the file uploads goes with site-two.

Somehow file templates are now not being applied. The files do get uploaded, but the .txt file generated just gets a sort order and a Uuid – nothing else.

I’ve tried duplicating the files blueprint directories both under site-one and under the site root (in parentheses below) just in case it was a domain/routing thing, but that’s had no effect.

structure:

Multisite.com
-- assets
-- kirby
-- (site)
-- -- (blueprints)
-- -- -- (files)
-- SITE-ONE.COM
-- -- assets
-- -- content
-- -- media
-- -- site
-- -- -- accounts
-- -- -- blueprints
-- -- -- -- fields
-- -- -- -- (files)
-- -- -- -- pages
-- SITE-TWO.COM
-- -- assets
-- -- content
-- -- media
-- -- site
-- -- -- accounts
-- -- -- blueprints
-- -- -- -- fields
-- -- -- -- files
-- -- -- -- pages

index.php:

<?php
require 'kirby/bootstrap.php';

$sites = [
  'site-one.com' => 'site-one.com',
  'site-two.com' => 'site-two.com',
];

$host = Url::host();
$root = $sites[$host];
$url  = 'http://' . $host;

$kirby = new Kirby([
	'roots' => [
	  'index'   => __DIR__,
	  'site'    => $root . '/site',
	  'content' => $root . '/content',
	  'media'   => $root . '/media',
	  'assets'  => $root . '/assets'
	],
	'urls' => [
	  'media'  => $url . '/' . $root . '/media',
	  'assets' => $url . '/' . $root . '/assets',
	],
  ]);

echo $kirby->render();

excerpt of panel blueprint:

sections:
      # Files section: https://getkirby.com/docs/reference/panel/sections/files
      general:
        label: General Information
        help: after uploading, select the file to add a title
        type: files
        template: general
        info: "{{ file.title }} - {{ file.category }}"
      registration:
        label: Registration Statement
        help: after uploading, select the file to add a title
        type: files
        template: registration
        info: "{{ file.title }} - {{ file.category }}"

I’ve reset permissions on the Ubuntu test server with:

# change owner for all Kirby files and folders:  
sudo chown -R www-data:www-data *

# change rights on all Kirby files and folders
sudo find /var/www/ -type d -exec chmod 755 {} +
sudo find /var/www/ -type f -exec chmod 644 {} +

… but uploads behave the same on the test server as on my Windows local dev.

Again, it was working fine before the split.

I’m not sure what else to share that might hint at the problem. Halp…?

If the site folder is the same for both domains, why don’t they share it?

I don’t have an answer now, need to rebuild such a setup first.

Thanks for the attention, @texnixe
The site folders are duplicated because the sites share much, but not all. There are minor changes to site.yml and the header & footer templates. (But right now everything else in /site/ is mirrored.)
I could send a .zip if it would help you examine details…

That would be great!

1 Like

For anyone coming around this and wondering why I marked it as solved:

The file blueprints assigned to each section contained a field called template. This prevented the template being assigned at upload after the update to Kirby 4.

Changing templates is now possible via the changeTemplate feature: Files in the Panel | Kirby CMS

Huge thanks to @texnixe for helping me solve this via messaging! She even provided a workaround that let me keep my current code while staying compatible with the new template assignment method.
Above & beyond! :rocket: