Can't upload Files in Grapejs

Your software
My Mautic version is: 4.4.1.0
My PHP version is: 8.0
My Database type and version is: MySQaL 8.0

Your problem
My problem is:

I can’t upload images in Grapejs email builder. The popup works, I can select a file from my computer but then nothing happens and no file is uploaded.

These errors are showing in the log:

There is an error in the log:

[2023-09-20 14:26:09] mautic.WARNING: PHP Warning - Undefined variable $uploadedFiles - in file …/plugins/GrapesJsBuilderBundle/Helper/FileManager.php - at line 67 {“hostname”:“xxxxxxxxxxxremovedxxxxxxx”,“pid”:2607660}
[2023-09-20 14:52:44]

And in console AFTER the upload fails…
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
https://xxxxxxxxxxxx/s/grapesjsbuilder/upload
(This is weird because that’s not even the upload folder in the settings!)

Steps I have tried to fix the problem:

It’s a new install.
I cleared the cache both by console command and by removing the cache folder.
I reset permissions via SSH
I reset file ownerships via SSH
I checked the .htaccess file and compared it to a working installation (It works but an earlier version 4.4.9) The server settings in terms of memory, PHP version, etc. are exactly the same just the version is older.
I checked file manager on line 67 and it’s just a warning because the variable is undeclared because the if statement doesn’t pass. Declaring the variable before the if statement removes the error, but does not fix the issue.

Some further info on this. I installed the latest version on another server and it works. So it’s not a Mautic bug. It has to be some setting on the server for this installation. Anyone have any ideas what to check?

I should also add that asset upload works, so it’s not a general file upload problem. It’s specific to uploading media.