#!/usr/local/bin/php?php
/* $Id$ */
include("guiconfig.inc");
if($config['theme'] <> "")
$g['theme'] = $config['theme'];
else
$g['theme'] = "pfsense";
$url = 'progress.php?UPLOAD_IDENTIFIER='. $_GET["UPLOAD_IDENTIFIER"] .'&e=1';
function nice_value($x) {
if ($x < 100) $x;
if ($x < 10000) return sprintf("%.2fKB", $x/1000);
if ($x < 900000) return sprintf("%dKB", $x/1000);
return sprintf("%.2fMB", $x/1000/1000);
}
$X = upload_progress_meter_get_info( $_GET["UPLOAD_IDENTIFIER"] );
if (!$X) {
if ( array_key_exists( "e", $_GET ) ) {
echo "
Invalid Meter ID! {$_GET["UPLOAD_IDENTIFIER"]}";
echo ('');
}else{
echo ('');
}
}else{
$meter = sprintf("%.2f", $X['bytes_uploaded'] / $X['bytes_total'] * 100);
$sp = $X['speed_last'];
if ($sp < 10000) $speed = sprintf("%.2f", $sp / 1000);
else $speed = sprintf("%d", $sp / 1000);
$eta = sprintf("%02d:%02d", $X['est_sec'] / 60, $X['est_sec'] % 60 );
$upl = nice_value($X['bytes_uploaded']);
$total = nice_value($X['bytes_total']);
if ($X['bytes_total'] > 1 && $X['bytes_uploaded'] >= $X['bytes_total'] && $X['est_sec'] == 0) {
echo (' UPLOAD completed!');
}else{
?>
Uploading Files... Please wait ...
Uploading files...
Time Remaining: | =$eta?> |
Speed: | =$speed?>KB/sec |
Uploaded: | =$upl?> |
File Size: | =$total?> |
Completed: | =$meter?>% |
| |
|