<?php
error_reporting(0);
include( "mime.php" );
function streamFile($fileDir, $fileName) {
$completeFilePath=$fileDir.'/'.$fileName;
$fnamearray = explode(".", $fileName);
$num = count($fnamearray);
$mime = MIMEtype($fnamearray[$num-1]);
header("Content-type: $mime\nContent-Disposition: inline; filename=$fileName\nContent-length: ".(string)(filesize($completeFilePath)));
$fd=fopen($completeFilePath,'rb');
while(!feof($fd) and (connection_status()==0)) {
print(fread($fd, 16384));
flush();
}
}
function downloadFile($fileDir, $fileName) {
$completeFilePath=$fileDir.'/'.$fileName;
$fnamearray = explode(".", $fileName);
$num = count($fnamearray);
$mime = MIMEtype($fnamearray[$num-1]);
//header("Content-type: $mime");
header("Content-Disposition: attachment; filename=".$fileName);
$fd=fopen($completeFilePath,'rb');
while(!feof($fd) and (connection_status()==0)) {
print(fread($fd, 16384));
flush();
}
}
?>