Hi everybody,
I am currently working on an activity module, where the creator should be able to upload a pdf (or select an already existing pdf, which is already stored in moodle). There are also some other kind of information submitted within the same form as the file. I already figured out how to store the information except the file.
in the mod_form.php I already added the filepicker element, but somehow i am unable to save and store the the pdf in my add_instance function (inside lib.php). As far as i understood, there are two ways to store a file in moodle: 1. Store it by yourself within the activity module, or 2. let the file api of moodle manage and save the submitted file. I would like to do the second thing, since I want also offer the opportunity to select an already existing file within this lecture/module and would like to keep all the pdfs reusable within other plugins.
So i already read the files api documentation and checked some other activity modules, but somehow I am unable to figure out how to properly add this file. I also had a briefly look over the resource mod files, but again without success.
Could someone share an concrete example of how to store a pdf with moodles file api (or anything else that would fit my requirements)?
I am fairly new to moodle plugin development and might be on the wrong track here, so any help is appreciated.
thanks in advance!