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.

Content Editor Discussions /

Forum for content editors and CMS users.

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

Problem uploading photos


Reply


2 Posts   309 Views

Avatar
Quan

Community Member, 1 Post

29 May 2014 at 7:28pm

Hello,
when I upload photos in Silver Stripe I get following error:

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

I tried to find a slution in Google, bot the only possible couse of this problem I found is exceeded disk quota or no access rights to the uploads directory.
The access rights are 0777 and disk quota is definitely not exceeded.

Avatar
Jare

Community Member, 5 Posts

12 August 2014 at 4:02am

Edited: 15/08/2014 5:34pm

I have exactly the same error message. I'm using SilverStripe 3.1.5. Images get uploaded correctly into the folder and can be seen in the Files section of the CMS. The problem is that they do not get linked with the data object for what they were uploaded.

I can see this in the error log:

PHP Fatal error: Call to a member function getURL() on a non-object in /*path-to-silverstripe*/framework/forms/UploadField.php on line 911, referer: https://*silverstripe-url*/admin/subjects/Subject/EditForm/field/Subject/item/57/edit

Edit: I managed to get this fixed for myself (finally). I'm using SortableFiles module and forgot to add $many_many_extraFileds to my class, which led to my relation table not having a 'SortOrder' field. That made saving records of files to the database to fail.