I think the problem is the File API
Function "upload" (files/externallib.php)
if ($dir = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, '.')) {
That is ever "false" - but the File is correct in the temp Path "moodledata/temp" (why not temp/wsupload ?)
Input from $context, $component, $filearea, $itemid, $filepath
object(context_user)#132 (5) { ["_id":protected]=> int(31) ["_contextlevel":protected]=> int(30) ["_instanceid":protected]=> string(1) "5" ["_path":protected]=> string(5) "/1/31" ["_depth":protected]=> string(1) "2" } string(4) "user" string(5) "draft" int(52815862) string(1) "/"
Tested on: 3.4+ (Build: 20171208)