<?php
ob_clean();
if(isset($_REQUEST['po_invoices_id']) && $_REQUEST['po_invoices_id'] !=''){
	$po_invoices_id = $_REQUEST["po_invoices_id"];
	$document_name = utility::getTableFieldById("po_invoices","document_upload","id",$po_invoices_id);
	$uploaded_file = "po_invoices_documents/".$document_name."";
	if (file_exists($uploaded_file)) {	
		header('Content-Description: File Transfer');
		header('Content-Type: application/octet-stream');
		header('Content-Disposition: attachment; filename="'.basename($uploaded_file).'"');
		header('Expires: 0');
		header('Cache-Control: must-revalidate');
		header('Pragma: public');
		header('Content-Length: ' . filesize($uploaded_file));
		readfile($uploaded_file);
		exit;
	}
}
?>