I have been search how to upload a file to moodle, I understand with the function “core_files_upload” the file is uploaded into a “draft area”, but I don’t know how to move the file from this area to a specific activity of a course.
I got this response after using the function upload_file
{‘contextid’: 16, ‘component’: ‘user’, ‘filearea’: ‘draft’, ‘itemid’: 12345, ‘filepath’: ‘/’, ‘filename’: ‘ejemplo2.png’, ‘url’: ‘https://xxxxxxx/draftfile.php/16/user/draft/12345/ejemplo2.png’}
Juan Jose is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.