Jump to content

Recommended Posts

Posted

Hello,

I have repeater field with an image field as one of its fields. It works correctly on all but one templates. I added an image, it shows the image uploading, but then the image just disappears and it doesn't save. What could it be ?

 

Thanks

Posted

not showing me any errors. also, i just tried adding the image field on its own, and uploading new images are not saving to it either.

 

Posted

I enabled debugger, and now I see this error when I upload an image

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

parseJSON .../wire/modules/Jquery/JqueryCore/JqueryCore.js:2:13582
uploadFile/< .../wire/modules/Inputfield/InputfieldImage/InputfieldImage.js:1450:21

Posted

Hmm that error means either pw returns empty json or you echo a string somewhere and json becomes invalid. 

On your developer console (F12) activate network tab then try adding an image, inspect the request and response values, check if something weird is going on

Posted

thing is, it worked for all the other sections, and just today i added a new section and i am having this problem. i didnt change anything in the code

Posted

similar problems were reported here:

google error-msg site:.processwire.com, e.g.

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data site:.processwire.com

Posted

thank you. i looked through some of the similar posts before i posted, didnt help.

will try to google that error message, thanks

Posted

seems the error is caused by this line, in InputfieldImage.js

var response = $.parseJSON(xhr.responseText),

Posted

also, just noticed that this error is happening on every single image field now. i can't upload new images to the site.

i didn't make any edits to the server, so not sure why this is happening all of a sudden

Posted

I've just checked the source for InputfieldImage and it definitely originates from the backend. Somehow along the way json gets corrupted/wrong data is returned. 

You need to check the server response using developer console to get an idea of what it really is. 

https://developers.google.com/web/tools/chrome-devtools/network-performance/reference

Just to cross it off the list, try downloading the latest source from GitHub and replacing /wire/ directory. 

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
×
×
  • Create New...