title: PHP filesize reporting old size
body: <p>The following code is part of a PHP web-service I've written.  It takes some uploaded Base64 data, decodes it, and appends it to a file.  This all works fine.</p>
  
  <p>The problem is that when I read the file size after the append operation I get the size the file was before the append operation.</p>
  
  <pre><code>$fileOut = fopen($filepath.$filename, "ab")
  fwrite($fileOut, base64_decode($data));
  fflush($fileOut);
  fclose($fileOut);
  
  $newSize = filesize($filepath.$filename);   // gives old file size
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>System is:</p>
  
  <ul>
  <li>PHP 5.2.14</li>
  <li>Apache 2.2.16</li>
  <li>Linux kernel 2.6.18</li>
  </ul>