title: how to download file cakephp 2.4
body: <p>I have 4 different types of file to download image/doc/pdf/xls. I want to download the file once I clicked on file link.</p>
  
  <p>//controller</p>
  
  <pre><code>public function sendFile($id) {
      $file = $this-&gt;Attachment-&gt;getFile($id);
      $this-&gt;response-&gt;file($file['path']);
      // Return response object to prevent controller from trying to render
      // a view
      return $this-&gt;response;
  }
  </code></pre>
  
  <p>//view</p>
  
  <pre><code>&lt;a href="&lt;?php echo $this-&gt;response-&gt;file($file-&gt;path); ?&gt;"&gt;&lt;?php echo $file-&gt;name; ?&gt;&lt;/a&gt;
  </code></pre>