I am using this function here:
http://www.php.net/manual/en/session.upload-progress.php
And here is my code for the progress uploading:
<?
session_start();
$key = ini_get("session.upload_progress.prefix") . "myForm";
if(!empty($_SESSION[$key])) {
echo "<table width='400' style='font-family: Verdana; font-size: 12px;'>";
foreach($_SESSION[$key]['files'] as $f)
{
// Get percentage done
$current = $f["bytes_processed"];
$total = $f["content_length"];
if($current < $total) {
$done = ceil($current / $total * 100);
} else {
$done = 100;
}
echo " <tr>
<td colspan=2>{$f['name']}</td>
</tr>
<tr>
<td colspan=2><img src='uploading.gif' width='{$done}px' height='13px'></td>
</tr>
<tr>
<td>Started @ ".date("H:m:s",$f['start_time'])."</td>
<td>{$done}%</td>
</tr>";
}
echo "</table>";
}
?>
The problem is that the individual files do not have a content_length
variable. How can I work the progress for each file that is uploaded?