psy Posted April 18, 2023 Share Posted April 18, 2023 (edited) There are many forum topics and suggested solutions to problems uploading images in PW admin. I've read all I can find but none address the problem I'm experiencing. It's consistent and repeatable. I have an image field in my template (duh!) and I can successfully upload any images with an approved image file type that has a file size over 10kb. Any images (png or jpg in this case) with file size of <10kb fail with the following error: I have even taken one of the small images, given it a bigger canvas in Photoshop, converted to PNG/JPG and successfully uploaded it. I could also hack it and make all my images bigger then use the api/image variations to reduce them on frontend output but that's not the point and a lot of unnecessary effort and wasted disk storage. Suggestions on how to fix the underlying problem most welcome. TIA Solved Thanks @netcarver for suggesting it may be a ModSecurity issue. Nailed it. Web host whitelisted my IP from their (obscure) rule and the uploads worked perfectly ? Edited April 19, 2023 by psy Problem solved Link to comment Share on other sites More sharing options...
netcarver Posted April 18, 2023 Share Posted April 18, 2023 Looks like the ajax upload is leading to the 403 page being returned - html where json was expected. Question is why. Do you have any custom (non standard PW) directives in your .htaccess file? What version of PW are you running there? Other things - is this running on a platform with a WAF/Modsecurity or other front-end? 1 Link to comment Share on other sites More sharing options...
psy Posted April 18, 2023 Author Share Posted April 18, 2023 @netcarver Using PW 3.0.210 and nothing special in .htaccess other than ProCache directives, https only and <IfModule mod_mime.c> AddType image/webp .webp </IfModule> Strange that it only happens on small images. No problem at all on larger image file sizes. I changed the default image quality from 90% to 100% in case that made the file invalid but no difference. All PHP image processing modules seem OK. As for ModSecurity, yes it's on a shared host that has ModSecurity. That's been a nightmare on many occasions for other things. I have the web host on speed dial. Good call to check that one. Link to comment Share on other sites More sharing options...
wbmnfktr Posted April 18, 2023 Share Posted April 18, 2023 Could you provide a sample image? And... could you please export the field so I can import it here and compare it? My testing worked with a 1kb JPG pretty fine in PW 3.0.210. Additional note: Please open that image you try to upload and save/export it again as JPG or PNG. I bet there is something wrong with the file itself. 1 Link to comment Share on other sites More sharing options...
psy Posted April 19, 2023 Author Share Posted April 19, 2023 10 hours ago, wbmnfktr said: Could you provide a sample image? And... could you please export the field so I can import it here and compare it? My testing worked with a 1kb JPG pretty fine in PW 3.0.210. Additional note: Please open that image you try to upload and save/export it again as JPG or PNG. I bet there is something wrong with the file itself. Thank you for investigating @wbmnfktr ? I had tried re-saving in different formats without success. It was only when I made one image bigger and it uploaded that I realised the file size was triggering the issue. @netcarver's suggestion of a ModSecurity issue with the web host was 100% and nothing to do with PW. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now