Can't upload Record Audio file in Moodle 2.9

Re: Can't upload Record Audio file in Moodle 2.9

by Paul Nicholls -
Number of replies: 1

Hi Andre,

I'm still unable to replicate the issue on my Moodle 2.6 instance.  The difference in returned data between the first and second attempt with the same file name is expected, and all looks fine.  The permission error that you were getting before you added the contains_private_data method makes me suspect that it's related to the way you've disabled private files.  Can you please confirm whether you've simply followed the instructions in the docs, or if something further has been done to disable private files? 

In reply to Paul Nicholls

Re: Can't upload Record Audio file in Moodle 2.9

by Andre Dixon -

Hello Paul,

After digging around for a bit. I realized that the issue is actually an issue in the filepicker.js found in /reposiory.
It tries to parse the response which is totally valid json but for some reason, is not parsing the numeric values.


Here is the error caught with a try block

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

 and here is what is tries to parse.

{"url": "http://aum26.localhost/draftfile.php/5/user/draft/429992676/new_recording.mp","id": ​429992676,"file": "new_recording.mp3"}

As you can see, it is valid json. To get around the issue, I output the ID as a string and not a int.


To do this, I adjusted lone 183 in lib.php from

                'id'=>$record->itemid,    

to

                'id'=>"$record->itemid",