<?php 

session_start();

$base_url= $_SESSION["BASE_URL"];
$file_name = isset($_GET['FILE'])?$_GET['FILE']:'';
if($file_name){
	$file_url = __DIR__.'/Excel_result/'.$file_name ;
	
	$finfo = finfo_open(FILEINFO_MIME_TYPE); 
	$mime =  finfo_file($finfo, $file_url);
	finfo_close($finfo);
	
	// send header information to browser
	header('Content-Type: '.$mime);
	header('Content-Disposition: attachment; filename='.$file_name);
	header('Content-Transfer-Encoding: binary');
	header('Expires: 0');
	header('Cache-Control: must-revalidate');
	header('Pragma: public');
	header('Content-Length: ' . filesize($file_url));
	//ob_clean();
	//flush();
	//readfile($file_url);
	
	ob_get_clean();
	echo file_get_contents($file_url);
	ob_end_flush();
}

?>