Jump to content

Recommended Posts

Posted

Hello, I am facing an upload issue. I get this JS error when I drop images in image fields:

XHR POSThttps://foo.com/admin/page/edit/?id=1102&InputfieldFileAjax=1[HTTP/2 403 41ms]

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    uploadFile https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    uploadFile https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    traverseFiles https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    setupDropzone https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    setupDropzone https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    initHTML5Item https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    initUploadHTML5 https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    jQuery 2
    initUploadHTML5 https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    init https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    InputfieldImage https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    <anonymous> https://foo.com/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js?v=122-3.0.246:1
    jQuery 8

InputfieldImage.min.js:1:35804

image.png.7459bf635f0945025093730e0ebf6e1d.png

 

I updated PW recently and also upgraded the PHP version. Maybe that can be related!

Posted

Check PW error logs. This is because of the error in php/module resulting in invalid JSON. Do a modules refresh and upgrade them to the latest version.

Posted

Thank you @matjazp. I refreshed the modules from the log.
I think I updated all the module that needed to be updated (I guess). I also installed the Upgrades module to be sure. The logs doesn’t log anything when I try to upload an image. The error remains.

My FieldtypeFile module is at v. 1.0.7 and FieldtypeImage at v. 1.0.2. 

Posted

Yes I have PHP 8.4. I tried to install the PW version you advise, but my site and admin went totally blank, even with debug enabled in config.

Posted

Do you have access to admin? To the file system? Double check that you uploaded the complete wire directory and new indxex.php file.

Posted

Yes, I triple checked everything. Also, I wonder why it would not work with the current PW version I use: 3.0.246

Posted
11 hours ago, rooofl said:

Also, I wonder why it would not work with the current PW version I use: 3.0.246

Because 3.0.246 might not be 100% compatible with PHP 8.4. 

On 10/10/2025 at 1:51 PM, rooofl said:

I tried to install the PW version you advise, but my site and admin went totally blank, even with debug enabled in config.

That's odd. I use this version even on PHP 8.5 without (major) issues.

Posted
12 hours ago, matjazp said:

Because 3.0.246 might not be 100% compatible with PHP 8.4. 

But the issue existed with the older version of PHP I ran, actually I upgrade PHP and PW because of this issue.

Posted
3 hours ago, rooofl said:

But the issue existed with the older version of PHP I ran, actually I upgrade PHP and PW because of this issue.

This is new information. You stated in the first post that your upgraded PHP and PW.

Check XHR response headers in browser's dev tools.

Posted

There are quite a few topics with this issue but maybe this specific answer from @Robin S could help?

Also, since it seems to be an issue with AJAX, are you seeing any difference if you toggle on (or off) this option?

Screenshot2025-10-12at21_55_04.thumb.png.62205703d0dc383c991840aa64318c2c.png

  • Like 1
Posted (edited)

@matjazp I understand this was precious information, and I am sorry I missed that in the first place.

@monollonom Than you for the suggestions.

  • The XHR response I get when uploading is 403 forbidden
  • I am not sure if I use or not ImageSizerEngineImagick. I guess I don’t, but how can I be sure?
  • toggling to Overwrite existing files ON doesn’t solve the issue.

Thank you for taking time to help me.

Edited by rooofl
Posted
On 10/13/2025 at 8:10 AM, rooofl said:

I am not sure if I use or not ImageSizerEngineImagick. I guess I don’t, but how can I be sure?

In the “Core” tabs of the “Modules” page, look for the “IMagick Image Sizer” module and check if it’s installed. Is so, try uninstalling it and see if it solves your issue.

Screenshot2025-10-14at10_55_05.thumb.png.4e913114a4074c948a2debf90108bffc.png

Posted

Hey @rooofl,

I saw your request for help. I unfortunately don't do client work, but would still like to offer at least one additional chance for fixing this issue. It doesn't seem like this client is a Dreamhost customer, but it's entirely possible that the host may have similar configurations for security on their server. You may want to reach out to, or have the client reach out to, the webhost support team and ask if the URL as provided in the network devtools that you screenshotted would cause their server security to prevent the request.

For Dreamhost, the solution was simply to change the custom URL for the administrative panel from whatever custom option (ex: "admin" in your screenshot's case) back to the default of "processwire". This is due to their custom mod_security rules. They can update their rules for one-off requests, but the next time they update the server software it'll break again.

Here's where I mention it:

It's worth a shot to, at least, try changing the admin panel URL from "admin" to "processwire" and then testing an upload to see if it fixes things. Otherwise a support ticket to the webhost would be my next suggestion.

  • Like 2
Posted

Solved!
As @matjazp advised in PM, mod_security was the problem. I contacted my host provider (OVH) and changed in .ovhconfig the line:

http.firewall=security to  http.firewall=none

Thank you all for your time.

  • Like 4

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...