How to get current uploaded bytes in php?
<p>How can I log and get the current bytes being uploaded from a html form to a PHP script? I want to later store the current progress in a session or log so that another AJAX script can retrieve it. Here is my current code to read the current bytes but It doesn't work.</p>

<pre><code>$file_type = $_FILES['Filedata']['type'];
$file_name = $_FILES['Filedata']['name'];
$file_size = $_FILES['Filedata']['size'];
$file_tmp = $_FILES['Filedata']['tmp_name'];

 $filePointer = fopen($_FILES['Filedata']['tmp_name'], "rb");
 $rr=0;

 if ($filePointer!=false){
 while (!feof($filePointer)){
     $fileData = fread($filePointer, 4096);
     $rr =$rr+strlen($fileData);
     // Process the contents of the uploaded file here...
     $_SESSION['fname']=$rr;
 }

fclose($filePointer);
}

move_uploaded_file ($file_tmp, "files/".$file_name);
</code></pre>
