Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SyntaxError: JSON.parse: unexpected character

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

Page: 1
Go to End
Author Topic: 1521 Views
  • merrick_sd
    Avatar
    Community Member
    95 Posts

    SyntaxError: JSON.parse: unexpected character Link to this post

    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"

  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Re: SyntaxError: JSON.parse: unexpected character Link to this post

    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?

  • feejin
    Avatar
    Community Member
    22 Posts

    Re: SyntaxError: JSON.parse: unexpected character Link to this post

    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?

    1521 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.