by Alvaro Devotto.
Hi, i try upload a file into a course, but don't work. The web service requires that the parameter "component" is equal to "user" and that "filearea" is equal to "draft". Assign these parameters, and put the value "course" in "contextlevel" and the course id in "instanceid".
But, I get the error "nofile", I checked the moodle code, I could not understand how to save a file in a course using webservice, so that a student can download it from moodle.
My client WS
- "wstoken"- [My Token]
- "wsfunction"- "core_files_upload"
- "component"- "user" (only can be this, or the ws produces error)
- "filearea"- "draft" (only can be this, or the ws produces error)
- "itemid"- "0"
- "filepath"- "/"
- "filename"- [filename + extension] (example: report.pdf)
- "filecontent"- [base64 file]
- "contextlevel"- "course"(i try put the file here)
- "instanceid"- "13"(in this course id)
Return:
nofile File not specified
Thanks for your help