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
37
38
39
40
41
42
43
44
45
|
<? @extract($_REQUEST);
$decodeName = base64_decode($view); $imgName = explode("-",$decodeName);
$img_name = $imgName[0] . ".gif"; $path="/home/mjc1/public_html/seal/$img_name"; $filename = $img_name; $mimetype = "image/gif";
$file_extension = strtolower(substr(strrchr($filename,"."),1));
//This will set the Content-Type to the appropriate setting for the file switch( $file_extension ) { case "gif": $ctype="image/gif"; break; case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; }
if(file_exists($path)){ header("Content-Type: $ctype application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename); header("Content-Transfer-Encoding: binary"); header("Cache-control:private"); header('Last-Modified: '.gmdate('D, d-M-Y H:i:S',filemtime($path)).' GMT'); header("Cache-Control: no-store, no-cache, must-revalidate"); readfile($path);
}else{ echo("--"); }
?>
|