-
Notifications
You must be signed in to change notification settings - Fork 0
/
down2.php
30 lines (26 loc) · 834 Bytes
/
down2.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
<?php
$filename ="abc.png";
$url = "C:/Users/ypila/Desktop/blow/decrypt/".$filename."";
//Get file
$source = file_get_contents($url);
//Image Mime types
$images = array('jpg'=>'image/jpg','png'=>'image/png','png'=>'image/png');
//Is it an image extention
if(in_array(substr($url,-3),$images)){
$type = $images[substr($url,-3)];
}else{
//No its somthing else
$type = 'application/octet-stream';
}
//Set the headers
header('Content-Description: File Transfer');
header('Content-Type: '.$type);
header('Content-Disposition: attachment; filename='.basename($url));
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . sprintf("%u", strlen($source)));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
header('Pragma: public');
//echo the source
echo $source;
?>