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

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

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

if( 
$refid && $row getDB("inv_product_img"$refid) ){
    
$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']);
}
?>