General developer forum

overriding functions in lib/filelib.php

 
6
Re: overriding functions in lib/filelib.php
 

what I want to achieve:

when a user tries to download a .php file that a user (him or another) uploaded - I want to deny the download for security reasons and display an error message instead.

by the way I already managed to prevent users from uploading .php files in the first place.


 
Average of ratings: -
Picture of Olumuyiwa Taiwo
Re: overriding functions in lib/filelib.php
Particularly helpful Moodlers

If you're doing that in a plugin, you should implement the function MYPLUGIN_pluginfile(...) in your plugin's lib.php, and control access there. 

See https://docs.moodle.org/dev/File_API#Serving_files_to_users

 
Average of ratings: -