Project

General

Profile

Download (2.87 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/* $Id$ */
4

    
5
include("guiconfig.inc");
6

    
7
$url = 'progress.php?UPLOAD_IDENTIFIER='.  $_GET["UPLOAD_IDENTIFIER"] .'&e=1';
8

    
9
function nice_value($x) {
10
   if ($x < 100)  $x;
11
   if ($x < 10000)  return sprintf("%.2fKB", $x/1000);
12
   if ($x < 900000) return sprintf("%dKB", $x/1000);
13
   return sprintf("%.2fMB", $x/1000/1000);
14
}
15

    
16

    
17
$X = upload_progress_meter_get_info( $_GET["UPLOAD_IDENTIFIER"] );
18
if (!$X) {
19

    
20
   if ( array_key_exists( "e", $_GET ) ) {
21
      echo "<HTML><BODY onLoad='window.close();'>Invalid Meter ID! {$_GET["UPLOAD_IDENTIFIER"]}";
22
      echo ('</BODY></HTML>');
23
   }else{
24
      echo ('<HTML><meta HTTP-EQUIV="Refresh" CONTENT="1; url='. $url .'"><BODY></BODY></HTML>');
25
   }
26

    
27
}else{
28

    
29
   $meter = sprintf("%.2f", $X['bytes_uploaded'] / $X['bytes_total'] * 100);
30

    
31
   $sp = $X['speed_last'];
32
   if ($sp < 10000) $speed  = sprintf("%.2f", $sp / 1000);
33
   else $speed  = sprintf("%d", $sp / 1000);
34

    
35
   $eta = sprintf("%02d:%02d", $X['est_sec'] / 60, $X['est_sec'] % 60 );
36

    
37
   $upl   = nice_value($X['bytes_uploaded']);
38
   $total = nice_value($X['bytes_total']);
39

    
40
   if ($X['bytes_total'] > 1 && $X['bytes_uploaded'] >= $X['bytes_total'] && $X['est_sec'] == 0) {
41
      echo ('<HTML><BODY onLoad="window.close()"> UPLOAD completed!</BODY></HTML>');
42
   }else{
43

    
44
?>
45

    
46
<HTML>
47
<HEAD>
48

    
49
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=<?=$url?>">
50

    
51
<TITLE>Uploading Files... Please wait ...</TITLE>
52

    
53
<style type='text/css'> td {font-size: 10pt }</style>
54

    
55
</HEAD>
56
<BODY BGCOLOR="#FFFFFF">
57

    
58
<table height="100%" width="100%" cellPadding="4" cellSpacing="4" style="border:1px solid #990000;">
59
<tr><td>
60

    
61
   <font face="arial"><b><center>Uploading files...</b></center>
62

    
63
   <br>
64

    
65
   <table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
66
	<td width="5" height="15" background="bar_left.gif" align="top"></td>
67
	<td>
68
		<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
69
			<td background="bar_gray.gif"><?echo("<img src='bar_blue.gif' height='15' WIDTH='$meter%'>");?></td>
70
		</table>
71

    
72
	</td>
73
	<td width="5" height="15" background="bar_right.gif" align="top"></td>
74
   </table>
75

    
76

    
77

    
78

    
79

    
80

    
81
   <br>
82

    
83
   <TABLE WIDTH="100%">
84
   <tr>
85
   <td align="right"><font face="arial"><b>Time Remaining:</td><td><font face="arial"><?=$eta?></td>
86
   <td align="right"><font face="arial"><b>Speed:</td><td><font face="arial"><font face="arial"><?=$speed?>KB/sec</td>
87
   </tr>
88

    
89
   <tr>
90
   <td align="right"><font face="arial"><b>Uploaded:</td><td><font face="arial"><?=$upl?></td>
91
   <td align="right"><font face="arial"><b>File Size:</td><td><font face="arial"><?=$total?></td>
92
   </tr>
93

    
94
   <tr>
95
   <td align="right"><font face="arial"><b>Completed:</td><td><font face="arial"><?=$meter?>%</td>
96
   <td align="right"><font face="arial"><b></td><td><font face="arial"></td>
97
   </tr>
98

    
99
</td></tr>
100
</table>
101

    
102
</BODY>
103
</HTML>
104

    
105
<?  } } ?>
106

    
107

    
(65-65/117)