title: CakePHP: How to set file name when using $this->response->file()
body: <p>We're sending a zip file download as a response like this:</p>
  
  <pre><code>    $this-&gt;response-&gt;file( "/export/stuff.zip", array('downlaod'=&gt;true, 'name'=&gt;"stuff.zip") );
      return $this-&gt;response;
  </code></pre>
  
  <p>This works fine, BUT the file is always named <code>export.zip</code>. Our <code>name</code> option does not seem to have any effect. We've also tried without the .zip extension. This is confusing because the <code>name</code> options is shown <a href="http://book.cakephp.org/2.0/en/controllers/request-response.html#sending-files" rel="nofollow">here</a>, in the docs.</p>
  
  <p>What are we doing wrong?</p>
  
  <p><strong>Update:</strong>
  We figured out that the seemingly arbitrary name "export" is being copied from the name of the controller action. We changed the method name to "admin_exportt" and then we get exportt.zip every time. This isn't documented anywhere that I've seen.</p>
  
  <p>We found where the name is handled in the source code (/lib/Cake/Nework/CakeResponse.php:1254) and it appears that it should either use the original file name, or whatever is specified in the <code>name</code> options:</p>
  
  <pre><code>        if (is_null($options['name'])) {
              $name = $file-&gt;name;
          } else {
              $name = $options['name'];
          }
  </code></pre>