File uploaded link not working other than admin

Re: File uploaded link not working other than admin

by Amir Mustafa -
Number of replies: 0
I found the solution. Moodle dosen't permit the other users to have file download access. You need to edit in custom page.
You need to go to the draftfile.php page and comment below line (approx line 71). We have removed the validation that was restricting it.

// Download link shall be available for all the users (admin, student and teacher) - amir 14.06.2019
/* if ($USER->id != $userid) {
print_error('invaliduserid');
} */



There is another way you can proceed with the context id approach:
link
http://159.89.112.86/draftfile.php/5/user/draft/247314731/image-000007.dcm
$fullpath = "/$context->id/user/draft/$draftid/$relativepath";

So 5 is the context id. You need to get the context id.
First method was working for me and core changes was allowed done.

Cheers !