/var/www/enzatesting.onesolution.hk/dgn_drawing_download_drawing.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
<?php 
$formid 
"Drawing";
require_once 
"inc/configure.php";

if(
havePermission("GNr")==false){
    
myerror("Invalid Permission");    
}

$refid = (int)$_REQUEST['refid'];


$sql "SELECT * FROM dgn_drawing_img WHERE refid=:refid";    
$sth $dbh->prepare($sql);
$sth->execute( array(":refid"=>$refid) );
//echo $sth->getSQL( array(":refid"=>$refid) );
$row $sth->fetch();

$filename $row['img_src'];
$fileType explode(".",$filename);
//var_dump($fileType);
if(count($fileType)>=1){
    
$fileType $fileType[count($fileType)-1];
}
//echo "".$row['img_path'].$row['img_src'];
//echo "Content-type: image/$fileType";
//exit;
header("Content-type: image/$fileType");
header("Content-Disposition: attachment; filename=" urlencode(getOrgFilename($row['img_src'])));
readfile("".$row['img_path'].$row['img_src']);
?>