Issue to determine a currently downloading file size?
<p>I have an interesting problem. I need to do a progress bar from an asycronusly php file downloading. I thought the best way to do it is before the download starts the script is making a txt file which is including the file name and the original file size as well. </p>

<p>Now we have an ajax function which calling a php script what is intended to check the local file size. I have 2 main problems. </p>

<ol>
<li>files are bigger then 2GB so filesize() function is out of business</li>
<li>i tried to find a different way to determine the local file size like this:</li>
</ol>

<p>.</p>

<pre><code>  function getSize($filename) { 

       $a = fopen($filename, 'r'); 
       fseek($a, 0, SEEK_END); 
       $filesize = ftell($a); 
       fclose($a);
       return $filesize;
  } 
</code></pre>

<p>Unfortunately the second way giving me a tons of error assuming that i cannot open a file which is currently downloading.</p>

<p>Is there any way i can check a size of a file which is currently downloading and the file size will be bigger then 2 GB?</p>

<p>Any help is greatly appreciated.</p>
