I'm completely stumped on how to use the filemanager form element to have a user upload some files and save them.
I'm working on making a course resource where the instructor must upload one or more files. Then when a student opens the resource they will see some specially rendered version of what the instructor uploaded.
I managed to add the filemanager element to the form (that was the easy part).
But I cannot, for the ..... figure out how I'm supposed to use the 'file_save_draft_area_files' function to save the actual stuff.
The relevant pieces of my source code are attached to this post.
I used the 'mod_assign' activity as some sort of example, so I understood that the 'file_save_draft_area_files' function should be in the 'add_instance' function in the 'lib.php' file. But I can't get it to actually work. I currently get the error message in the image attachment. The stacktrace leads to the 'file_save_draft_area_files' in my 'lib.php' file.
I'm almost pulling my hair out, I don't understand. I'm thankful for all help on this.