Hi!,
I'm created a new module by using NEWMODULE template.
I added a File Manager file to upload files. I used this code to create a file link:
foreach ($files['files'] as $file) {
$filename = $file->get_filename();
$url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $filename, false);
$out[] = html_writer::link($url, $filename);
}
$br = html_writer::empty_tag('br');
But when i click on the link, i got error: Sorry, the requested file could not be found.
When i edit my module, i still see the files i uploaded.
Can anyone tell me the right way to use file link.
Many thanks!
Quoc Huy