summaryrefslogtreecommitdiffstats
path: root/application/libraries/Ddownload/drivers/Ddownload_lighttpd.php
blob: 31db4d340227476578d0a87ae1aa249d8b6959b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/*
 * Copyright 2013 Pierre Schmitz <pierre@archlinux.de>
 *
 * Licensed under AGPLv3
 * (see COPYING for full license text)
 *
 */

class Ddownload_lighttpd extends Ddownload_Driver {

	public function serveFile($file, $filename, $type)
	{
		$CI =& get_instance();
		$upload_path = $CI->config->item('upload_path');

		if (strpos($file, $upload_path) !== 0) {
			show_error('Invalid file path');
			return;
		}

		header('Content-disposition: inline; filename="'.$filename."\"\n");
		header('Content-Type: '.$type."\n");
		header('X-Sendfile: '.$file."\n");
	}

}