title: Assets graber with zend, big files download as 229 or 228 bytes only
body: <p>I have the following problem with a server, there many variables at play.  So this is what happened.  Everything was working perfect when I developed a small webapp with zend on my desktop on fedora.  Then I transfer the app to a server on dreamhost and everything worked fine.<br>
  So the problem comes with the client that needed a server on china, because they are behind the great firewall and they wanted to transfer their files really faster.  They had huge files, around 3.4 GB.  so they gave me windows 2003 machine virtual machine, and they couldnt change it to linux, and that is when everything went on a downward spiral.</p>
  
  <p>Basically my app had a folder outside the documentroot, where all the files where going to be upload via ftp.  My app read the files and only allowed logged users to download the files.</p>
  
  <p>This is my plugin - controller</p>
  
  <pre><code>&lt;?php
  
  class Mapache_Controller_Plugin_AssetGrabber
   extends Zend_Controller_Plugin_Abstract
  {
  
      public function dispatchLoopStartup (Zend_Controller_Request_Abstract $request)
      {
          if ($request-&gt;getControllerName() != 'assets')
              return;
  
          $auth = Zend_Auth::getInstance();
          if (!$auth-&gt;hasIdentity()) 
              throw new Exception('Not authenticated!');
  
          //$file = APPLICATION_PATH . '/../assets/' . $request-&gt;getActionName();
          $file = APPLICATION_PATH . '/..' . $_SERVER['REQUEST_URI'];
  
          $file = str_replace("_", " ", $file);
  //      echo $file;
          if (file_exists($file)) {
              header("Content-type: ".$this-&gt;new_mime_content_type($file));
              header('Content-disposition: attachment;');
              //header('Content-type: '.$this-&gt;new_mime_content_type($file));
              //readfile('$file');
              echo file_get_contents($file);
          }
      }
  
      function new_mime_content_type($filename){
          $result = new finfo();
  
          if (is_resource($result) === true){
              return $result-&gt;file($filename, FILEINFO_MIME_TYPE);
          }
  
          return false;
      }
  
  }
  </code></pre>
  
  <p>The only thing I changed for it to work on windows, was adding 
  $file="d:/". $_SERVER['REQUEST_URI'];, so it knows to look on the D: drive of the server.</p>
  
  <p>so basically i have another php file that does an scandir an lists all the files and directories and creates a link to URL/assets/folder/file, it works fine on my test server even with big files.  But when I try to download a zip file fo 200 mb from the windows server I get a corrupted zip file of 228 or 229 bytes, like just the header.<br>
  The server has xammp with zend installed, I am going crazy.  </p>
  
  <p>Migrating back to my dreamhost server will take days, I installed an rsync client on the server and started copying the files but in the last 4 it has only copy 400mb, so my 30 Gb of data will take days.</p>
  
  <p>When i log on to the server with rdesktop and try to download the files I still get 228 bytes of files instead of 200mb or even 3.4Gb.
  It has windows 2003.<br>
  Do I have to configure something on the apache server, something on the httpd.conf or php.ini?</p>