forked from bastoniyahya/TA-LMS-LSKK-STEI-ITB
-
Notifications
You must be signed in to change notification settings - Fork 1
/
software_download.php
36 lines (25 loc) · 926 Bytes
/
software_download.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
35
36
<?php
error_reporting(0);
include 'include/koneksi.php';
?>
<?php
$softwareid = $_GET['id'];
// membaca informasi file dari tabel berdasarkan id nya
$query = "SELECT * FROM tb_mdl_upload_software WHERE id = '$softwareid'";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$new_name = str_replace(" ", "", $data['software_name']);
header('Content-Description: File Transfer');
// header yang menunjukkan nama file yang akan didownload
header("Content-Disposition: attachment; filename=".$new_name );
// header yang menunjukkan ukuran file yang akan didownload
header("Content-length: ". filesize($data['path']));
// header yang menunjukkan jenis file yang akan didownload
header("Content-type: ".$data['type']);
header('Content-Transfer-Encoding: binary');
ob_end_clean();
$download = 'tatausaha/';
$data = $data['path'];
readfile($download.''.$data);
exit;
?>