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.

I have this issue AGAIN, on another server. I never was able to solve the original issue. The uplaod does not work in GrapeJS builder.

I’m getting a 403 for the upload folder.

  1. I’ve checked permissions
  2. Checked .htaccess
  3. The url is accessible
  4. Manually uploading images to the folder by FTP works.
  5. The default Asset manager in Mautic has no problems uploading files.
  6. I have Mautic installed on other servers where it works fine.

I’m out of ideas. Looking for other things to try. Anyone else experience this?

Ok finally solved it after 2 days of troubleshooting!

The issue is I have SuiteCRM installed in the root public_html and I have mautic installed in a subdirectory. The .htaccess rules for SuiteCRM are blocking the upload.

Specifically

RedirectMatch 403 ^/upload

so I changed it to:

<If "%{REQUEST_URI} !~ m#^/yoursubdomain\.yourdomainname\.com/s/grapesjsbuilder/upload$#">
  RedirectMatch 403 ^/upload
</If>

And now upload proceeds. I suspect if you have other software instaled in public_html and mautic in a subdomain below public_html you are going to encounter this.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.