Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/attachments.php
 <?php
	/*******************************************************************************
     **  File          :  attachments.php                                         **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  Read the attachments									  **
  	 **  Date          :  14/09/2005                                              **
     **  Last Modified :  14/09/2005                                              **
     **  PHP Version   :  5.0.3                                                   **
     **                                                                           **
     *******************************************************************************/
  $id=$_REQUEST['id'];

  $filepath="login/tmp/attachments/".$id;

  $filesize=filesize($filepath);

  if ($type=='doc') {
    header('Content-Type: application/msword');
    header('Content-Disposition: atachment; filename="'.$id.'"');
    header("Content-Transfer-Encoding: binary");
    } elseif (($type=='xls')) {
    header('Content-Type: application/msexcel');
    header('Content-Disposition: atachment; filename="'.$id.'"');
    header("Content-Transfer-Encoding: binary");
    }elseif (($type=='wmv')) {
    header('Content-Type: application/wmv');
    header('Content-Disposition: atachment; filename="'.$id.'"');
    header("Content-Transfer-Encoding: binary");
    }elseif (($type=='pdf')) {
    header('Content-Type: application/pdf');
    header("Content-Disposition: attachment; filename=".$id);
    header('Content-Disposition: inline; filename='.$id);
    header("Content-Transfer-Encoding: binary");
    }elseif (($type=='avi')) {
     header('Content-Type: application/avi');
     header("Content-Disposition: attachment; filename=".$id);
     header('Content-Disposition: inline; filename='.$id);
     header("Content-Transfer-Encoding: binary");
  }else {
    //header('Content-Disposition: inline; filename="'.$id.'"');
  }

     $fp = fopen($filepath, 'rb');
     $pdf_buffer = fread($fp, $filesize);
     fclose ($fp);

     print $pdf_buffer;


  ?>

Return current item: News Manager - RSS aggregator