<?php
  /**************************************************************************\
  * phpGroupWare application (NNTP)                                          *
  * http://www.phpgroupware.org                                              *
  * Written by Mark Peters <mpeters@satx.rr.com>                             *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

  /* $Id: view_attachment.php,v 1.10 2001/03/13 02:20:00 skeeter Exp $ */

	$phpgw_flags = Array(
		'currentapp'			=>	'nntp',
		'enable_vfs_class'	=>	True,
		'noheader'				=>	True,
		'nonavbar'				=>	True
	);

	
	$phpgw_info['flags'] = $phpgw_flags;

	include('../header.inc.php');

	$file = urldecode($file);
	$userfile = $phpgw->vfs->getabsolutepath($file);
	if (file_exists($userfile))
	{
		$img_type = strtolower(substr($file,strlen($file)-3,3));
		Header('Content-length: '.filesize($userfile));
		Header('Content-type: image/'.$img_type);
		Header('Content-disposition: attachment; filename="'.$attfile.'"');
		echo $phpgw->vfs->read($file);
		flush();
		$phpgw->vfs->rm($file);
	}
?>
