JSON Parse error with unrecognized token when trying to add own PHP code

3,530 views
Skip to first unread message

Andreas Heck

unread,
Aug 8, 2013, 3:16:57 AM8/8/13
to jquery-f...@googlegroups.com
I couldn't find any answer resp. solution for my problem:

jQuery-File-Upload working finde so far. But if I try to add some own PHP stuff, i get often the error:

SyntaxError: JSON Parse error: Unrecognized token '<'

I can not say what kind of PHP commands the script doesn't like, but although the error states the token '<' I've made the experience, that there is a problem with brackets and quotation marks. But not always, it depends on something I don't know!

Very strange. So the question is:

Has anybody had the same problem and has found a solution in the meantime?
Thanks in advance.

Greetings, Andreas.

Jaap Koelman

unread,
Aug 11, 2013, 8:41:05 PM8/11/13
to jquery-f...@googlegroups.com

Well, i did ran into a JSON problem too and maybe this one helps (not sure).

What i did was to modify the function generate_response within upload.class.
instead of 
$this->body($json);

i changed it too :
die($this->body($json));


Like said not sure if it's the correct thing to do but this time i'm seeing images + files are being uploaded

Andreas Heck

unread,
Aug 13, 2013, 6:22:19 AM8/13/13
to jquery-f...@googlegroups.com
The problem has been simply a PHP generated warning, so you're hint was right. Thank you for tha.t 

Alfonso Roman

unread,
Apr 19, 2014, 7:22:31 PM4/19/14
to jquery-f...@googlegroups.com
Hi Andreas, I already change the line of code with the new one (die($this->body($json));) but still have the same problem, did you do anything else for solving it?
Thank you.

Alfonso Roman

unread,
Apr 20, 2014, 2:24:13 PM4/20/14
to jquery-f...@googlegroups.com
Hello I already found out the problem, It was a security issue, in the folder where the files are saved.

luis...@gmail.com

unread,
Aug 4, 2014, 9:15:59 PM8/4/14
to jquery-f...@googlegroups.com
which were the folder permissions needed?
Reply all
Reply to author
Forward
0 new messages