| 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 $formid = "Drawing";
 require_once "inc/configure.php";
 
 if(havePermission("GNr")==false){
 myerror("Invalid Permission");
 }
 
 $refid = (int)$_REQUEST['refid'];
 
 
 $sql = "SELECT * FROM dgn_techdrawing_pdf 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'];
 
 
 $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
 $mime = finfo_file($finfo, $row['img_path'].$row['img_src']);
 finfo_close($finfo);
 
 
 header("Content-type: $mime");
 header("Content-Disposition: attachment; filename=" . urlencode(getOrgFilename($row['img_src'])));
 readfile("".$row['img_path'].$row['img_src']);
 ?>
 
 |