Location: PHPKode > projects > PushOk SEMA > html/web/attach_download.php
<?PHP
// Pushok's SEMA (Small Enterprise Management Application)
//
// Copyright (C) 2004 Pushok Software http://www.pushok.com
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html

if ( isset($_GET['id']) && $_GET['id']>0 )
{
	$GLOBALS['LIB_DISPATCHER']->ProcessMessage("LM_FILE_DATA_GET", $oIn=array('idcontact_current'=>$_SESSION['iduser'], 'idfile'=>$_GET['id']), $oOut=array());
	if ( isset($oOut[$_GET['id']]) && count($oOut[$_GET['id']]) )
	{
		header ("Content-Type: ".$oOut[$_GET['id']]['type'].";"); 
		header ("Content-Disposition: inline; filename=\"".$oOut[$_GET['id']]['name']."\""); 
		header ("Content-Length: ".$oOut[$_GET['id']]['size']); 
		header ("Pragma: public"); 
		header ("Expires: 0"); 
		header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
		print $oOut[$_GET['id']]['data'];
	}
	else
		return PEAR::raiseError("FILE: \"".__FILE__."\" LINE: \"".__LINE__."\" MSG: \""._LW("Access denied!")."\"", E_USER_WARNING);
}
?>
Return current item: PushOk SEMA