I've installed Drupal-9 using Composer and civicrm (5.64) as well and am using php8.1 on a Ubuntu 22 Linode server. When I edit a Mailing Template by uploading an image and click save, I get a success alert but the image is not actually saved. It doesn't appear in the editor nor is the image uploaded to the images upload directory which is set to [civicrm.files]/persist/contribute/images/.
The image folder is owned by www-data:www-data with 775. I tried copying a .png file to the folder and pointing a browser to https://subdomain.siteimworkingon.org/sites/default/files/civicrm/persist/contribute/images/gbc.png it displays the image. If I use developer tools and watch Network tab while I am saving the template there is no obvious post errors or anything I can see. I've also tried summernote editor with similar issues. I believe it must be a path or permission issue but I've reached the end of my troubleshooting skills. Any help will be much appreciated!
Al