How to get uploaded file path in moodle

How to get uploaded file path in moodle

by moodle learner -
Number of replies: 1

Hi 

moodle 2.7+

I have uploaded one file on moodle , I know it stores on moodledata . The path is as follows. I have to generate it through code. How each componenet stores please help me.

https://moodle/pluginfile.php/170/mod_resource/content/2/test.pdf


I know the following

How to get 2 , mod_resource through program from database.?

Average of ratings: -
In reply to moodle learner

Re: How to get uploaded file path in moodle

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What have you tried so far?

For example, have you looked at the code of mod/resource/view.php to see how the URL is generated by Moodle itself?

This is the part of the code that locates the file to display:

https://github.com/moodle/moodle/blob/master/mod/resource/view.php#L66 

This is the part of the code that generates a URL for the file that was located:

https://github.com/moodle/moodle/blob/master/mod/resource/view.php#L97