Getting the url for an uploaded file

Re: Getting the url for an uploaded file

by Andreas Grabs -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators

Hi Manolo,

the function should look like:

<your-plugin>_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) {
...
}

Here (https://docs.moodle.org/dev/File_API#Serving_files_to_users) you can find a good example for it.

Best regards
Andreas

Average of ratings: Useful (1)
In reply to Andreas Grabs

Re: Getting the url for an uploaded file

by Manolo Mohedano -
Thanks a lot, Andreas... I was no considering the variables $course and $cm, because it's a local pluging that was not intended to be instantiated in courses and I assumed wrongly that they would not be necessary.
I added those two parameters and it works correctly.

Thanks for your time, Andreas. Much appreciated.