title: Easy one condition statement file info
body: <p>i didnt found a good answer on the web..</p>
  
  <p>I'm using symfony2.5 and php 5.3 and creating a file explorer application.</p>
  
  <p>I want to know the extension of the file before apply the good associated content-type.
   mime_content_type function is deprecated..</p>
  
  <p>Here is my showAction{} , i need a function who test if the file is an excel one or a pdf file :</p>
  
  <pre><code>public function showAction($repertoire, $file)
  {
  
      $response = new Response();
      $response-&gt;setContent(file_get_contents(''.$repertoire.'/'.$file.''));
  
      if(file_info($file) == 'application/pdf'){
  
      $response-&gt;headers-&gt;set('Content-Type', 'application/pdf');
      $response-&gt;headers-&gt;set('Content-disposition', 'filename='. $file);
      return $response;
  
      }else {
  
      $response-&gt;headers-&gt;set('Content-Type', 'application/application/vnd.ms-excel');
      $response-&gt;headers-&gt;set('Content-disposition', 'filename='. $file);
      return $response;
      }
  }
  </code></pre>
  
  <p>I'm starting with programming. Can you help me guys ?
  Thanks a lot !</p>