Commit 7867da22 authored by Richard Mansfield's avatar Richard Mansfield

File downloading stuff from moodle

parent f83a41c9
This diff is collapsed.
......@@ -1052,4 +1052,18 @@ function get_dir_contents($directory) {
return $contents;
}
function serve_file($file, $filename) {
if (!file_exists($file)) {
header('HTTP/1.0 404 Not Found');
exit;
}
// Moodle security stuff went here...
require_once('file.php');
session_write_close(); // unlock session during fileserving
send_file($file, $filename);
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment