-
Notifications
You must be signed in to change notification settings - Fork 0
/
media-download-video.php
33 lines (29 loc) · 1.38 KB
/
media-download-video.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
<?php
if (!isset($_GET['remote_file_id'])) {
header("location: index.php");
exit;
}
include('includes/config.php');
$id = $_GET['remote_file_id'];
$query = "select tblvideos.PostTitle as posttitle,tblvideos.PostImage,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tblsubcategory.SubCategoryId as sid,tblvideos.PostDetails as postdetails,tblvideos.PostingDate as postingdate,tblvideos.PostUrl as url,tblvideos.File as file from tblvideos left join tblcategory on tblcategory.id=tblvideos.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tblvideos.SubCategoryId where tblvideos.id='$id'";
$result = mysqli_query($con, $query) or die(((is_object($con)) ? mysqli_error($con) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : true)));
$row = mysqli_fetch_assoc($result);
$filename = $row['file'];
$path = 'admin/videos/';
$file = $path . $filename;
if (!file_exists($file)) {
http_response_code(404);
die();
}
header('Content-Type: octet/stream');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=" . $filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file));
header("Cache-Control: private");
header('Expires: 0');
header('Pragma: public');
ob_clean();
flush();
readfile($file);
exit;