-
Notifications
You must be signed in to change notification settings - Fork 2
/
get.php
34 lines (33 loc) · 887 Bytes
/
get.php
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
28
29
30
31
32
33
34
<?php
session_start();
$user=$_SESSION['username'];
function sendHeaders($file, $type, $name=NULL)
{
if (empty($name))
{
$name = basename($file);
}
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="'.$name.'";');
header('Content-Type: ' . $type);
header('Content-Length: ' . filesize($file));
}
/*
* detect mime of the file type
*/
require 'mime_type_lib.php';
$mime_type = get_file_mime_type( './drive/'. $user . '/mix/'. $_GET['file']);
$file ='./drive/' . $user . '/' . $_GET['file'];
if (is_file($file))
{
sendHeaders($file,$mime_type,$user .'-'. $_GET['file']);
ob_clean();
flush();
@readfile($file);
exit;
}
?>