<?php
$fileToSend ='../upload/circulars/'.$_GET['filename'];

if(file_exists($fileToSend)){
	
	$fsize = filesize($fileToSend);
}else{
	echo "<script>alert('FILE Does Not Exist')</script>";
}

 

    $path_parts = pathinfo($fileToSend);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
        case "pdf":
        header("Content-type: application/pdf"); // add here more headers for diff. extensions
        header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
        break;
        default;
        header("Content-type: application/octet-stream");
        header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
		}
		
echo file_get_contents($fileToSend);

?>
 