Urgent help needed! - Invalid JSON String when uploading files.

Urgent help needed! - Invalid JSON String when uploading files.

by Chris Smallwood -
Number of replies: 21

I am running IIS7, Moodle 2.x, php 5.3.9, connecting to another moodle server's MYSQL DB for data.  I am able to log into the site, even upload files under 40MB but when I try anything above that it goves me an Invalid JSON String. 

Tried:  Increasing the PHP memory, increasing the post max and upload max in PHP.  Set site settings and course settings to 384MB and still nothing.  HELP!

Average of ratings: -
In reply to Chris Smallwood

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Jozef Silaci -

You need to increase upload limit also in IIS server configuration.

Try to add something like this to web.config in moodle web directory:

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="524288000"/>
        </requestFiltering>
    </security>
</system.webServer>

Content length value is in bytes.

Average of ratings: Useful (1)
In reply to Jozef Silaci

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Chris Smallwood -

Thank you Jozef!  Your response was critical to resolving my issue. 

The other problem that I found after the IIS limit was that the php.ini file referred to a temp folder that IIS USR didn't have permissions to. 

Changed that link and everything is now working!

In reply to Jozef Silaci

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Todd Bryant -

I had the same problem with the IIS upload limit.  Although instead of editing the web.config I ran this command to change the limit.

%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:524288000

In reply to Chris Smallwood

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Terra Graves -

Having same issue.  Is there anyway to upload a course that is 630MB?  Please advise.

In reply to Terra Graves

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Ken Task -
Picture of Particularly helpful Moodlers

In response to 'anyway to upload a course that is 630MB' ...

If using Moodle 2, might turn on the URL repo.

Create a directory at a web server root - not part of any app - called 'xfers'.  Scopy/FTP/drag and drop however you can get that 630MB file into xfers.  Check to see if one can access via browser.

Then, in Moodle 2, use the URL repo during the restore process and point the URL directly to the file in xfers.

Example: http://somesite/xfers/somemdlbackup.mbz (or .zip)

If successful in getting the 630 over into Moodle 2, be sure to remove the file from the xfers folder.  It's ok to leave an empty folder in case you find need again for such a thing.  Google can usually find just about anything! ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Dan Smith -

Hi Sorry to jump in here, but you guys seem to know what your talking about. smile

I am also having a invlaid JSON when uploading files. This takes places when students upload a file, when they are handing in an assignment.

The thing is that it is not across the board, it only happens to some students, file size does not seem to be a factor. The files are typically around 5MG. (I have set the allow limit much highier in the preferences).

The error appears when they select the file from their harddrive, however in a lot of cases if the student waits a while, the upload takes place, even though they are still given the error, and it does not appear to be successful. 

I would love some help with this, as telling students just to wait and ignore the error is very confusing for them, and makes us look unproffesional.

 

Cheers,

Dan

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Kerry J -

Dan, I'm having a similar issue.

Cheers

KerryJ

In reply to Kerry J

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Dan Smith -

I don't think anyone knows the answer to this issue. 

If anyone can even suggest methods for diagnosing it further, that would be a great help.

Cheers,

Dan

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Alexander Ufimtsev -

It's a long shot, but I had an issue similar to this. Switching browsers from Safari to Firefox solved the problem.

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Matt Leach -

Hi Dan,

I need a bit more information, however I have actually had a similar issue. I would like to say its a combination of browser cache and settings within your actual Moodle site. I believe (if I rememeber correctly) you need to go to the following:

Site Administration -> Appearance -> Themes -> Theme Settings

You are looking for Theme designer mode. You want to toggle this and also look for theme cache. I don't know if this is the way to solve it, but I do remember this is something I did around the time I had the same problem.

Apoligies I can't be more accurate. smile

In reply to Matt Leach

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Dan Smith -

Thanks for the respnonces. smile

There is nothing I can do about browsers. All our candidates have to use whatever browsers are supplied at their works.

I have adjusted the theme designed mode and have asked someone to test an upload for me.

What changes should I try and make in the theme cache?

 

If anyone else has encountered this error and remembers what they did please help. As we get more candidates, I'm getting more and more support emails.....help smile

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Jürg Hoerner -

I had the same problem with firefox. As I tried the with chrome it worked perfect. No problem. 

Jürg Hoerner

In reply to Jürg Hoerner

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Dan Smith -

Altering the cache did not work. sad

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Dan Smith -

SO we have a work around but it is not pretty.

Basically the error appears. You wait for the file to continue uploading (by watching the page loader at the bottom of the screen.)

If the user then clicks on 'recent files' in the file picker, the file is there and can then be added. Its not nice as the JSON error stays on the screen the whole time. But it does work.

How do I submit a bug to moodle?

In reply to Dan Smith

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Derek Chirnside -

I have seen this error also, but it has been unpredicatable.

I wrote some help here: http://docs.moodle.org/22/en/File_picker_FAQ#How_can_I_solve_the_.22Invalid_JSON_string.22_error.3F with a request for someone to help in the docs forum, but no takers yet.  I think the error can means a lot oof things and have several possible causes.

In the link above I've referred to a few tracker items.  It may take a few minutes, but you could check them out and add a comment if your case may be helpful to the coders fixing this.  Or you may find others have it, and you can add a vote and a "Me To"

-Derek

Average of ratings: Useful (1)
In reply to Derek Chirnside

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I saw your request for help in the docs forum Derek but I don't know anything about JSON string errors, despite having had some myself and  I thought you had done a pretty good job  yourself of collating all the evidence in that FAQsmile

In reply to Mary Cooch

Re: Urgent help needed! - Invalid JSON String when uploading files.

by al tobing -

Hi,

I also had just been hit with this error eventhough I had set up the upload limit properly. It had been working without any problem for about 1 month, then suddenly doing the same routine of uploading files this error occured. Btw, I use IE9 on windows 7 x64.

Following some previous suggestion, I try to use Chrome instead, and there is no JSON string error. I thought it might be a browser problem. So I just closed IE9, cleared all the cache, and re-login to my moddle site. And JSON string error is somehow gone.

In reply to al tobing

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Sam Mudle -

Had this same problem happen on some students machines running IE9.  It only happens every once in a while, and never seems to happen on Chrome.

I do see a few bug reports but it seems this has been happening since 1.9.  So maybe it's just an IE quirk.

In reply to Chris Smallwood

Re: Urgent help needed! - Invalid JSON String when uploading files.

by Gerald Brown -

I went to the Site Administration and then to Appearance and then Ajax and Javascript and then UNCheck Cache Javascript.  That seemed to clear up the problem.