Updating a structure file field programmatically using yaml

And do you find the file at the correct location after the form is submitted?

Yes, it is in the directory for the school page, with the correct prefix.

You could double check with file_exists in your custom action (using the exact same path). If the file exists there but the filename is not added to the page data, it may be some Kirby issue.

Another thought: Do you use multiple languages? I found that updating a page can be complicated if the “wrong” language is currently active.

Sorry, could you clarify where I need to put that file_exists? I am only using a single language

OK I have added this above the try in the custom action:

if(file_exists(kirby()->user()->school()->toPage()->contentFileDirectory() . '/' . $filename)): 
  echo ' - file exists';
else:
  echo ' - file does not exist';
endif;

And it is returning “file exists

Then Uniform seems to be working correctly.

Thanks for taking a look anyway.

Now I am totally stumped, and will have to walk away from my computer and go and live in the woods :deciduous_tree: