Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SyntaxError: JSON.parse: unexpected character


Reply

3 Posts   1549 Views

Avatar
merrick_sd

26 March 2013 at 2:28am (Last edited: 26 March 2013 2:39am), Community Member, 95 Posts

I am getting an error specifically in the damin when i go to Files > add files

I try to upload a jpg and i get SyntaxError: JSON.parse: unexpected character

my assets folder and cache folder have permissions.

NB: i "don't get errors" when i use the add image facility in the Tnymce content area or when i use an upload form on one of my dataobjects etc

access_logs

MYIP - - [25/Mar/2013:13:37:40 +0000] "POST /admin/assets/add/getEditForm/field/AssetUploadField/upload HTTP/1.1" 200 5207 "http://glucocompetitions.ccsw.co.uk/admin/assets/add" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:19.0) Gecko/20100101 Firefox/19.0"

MYIP - - [25/Mar/2013:13:37:40 +0000] "GET / HTTP/1.1" 200 6057 "http://glucocompetitions.ccsw.co.uk/admin/assets/add" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:19.0) Gecko/20100101 Firefox/19.0"

Avatar
merrick_sd

26 March 2013 at 3:55am Community Member, 95 Posts

changed Director::set_environment_type("dev"); to Director::set_environment_type("live");

and that fixed.

I tested it was that as well i cahnged it back and i got the error back.

So for some reason Director::set_environment_type("live"); is needed if you want to upload images via the built in Files > Add files facility.

Surely i'm missing something?

Avatar
feejin

27 March 2013 at 3:02am (Last edited: 27 March 2013 3:02am), Community Member, 22 Posts

Whenever I get this error it's to do with permissions.

Not sure why dev/live would affect that, though perhaps live is suppressing the error. Are the files actually being uploaded properly when in live mode?