From 8999038a6c5b85cd9efb1a6fbced532128ebf87a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 24 Nov 2008 03:12:07 +0000 Subject: Switch back over to upload_progress_meter now that it is a freebsd port. --- usr/local/www/upload_progress.php | 111 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 54 deletions(-) (limited to 'usr/local/www/upload_progress.php') diff --git a/usr/local/www/upload_progress.php b/usr/local/www/upload_progress.php index 8642a79..7df83ff 100644 --- a/usr/local/www/upload_progress.php +++ b/usr/local/www/upload_progress.php @@ -39,57 +39,28 @@ include("guiconfig.inc"); // sanitize the ID value -$id = $_REQUEST['uploadid']; -if (strlen($id) == 0) { - echo "Invalid uploadid#."; +$id = $_SESSION['uploadid']; +if (!$id) { + echo "Invalid upload id#."; exit; } -// ensure the uploaded status data exists in the session -if (!array_key_exists($id, $_SESSION[self::SESSION_KEY])) { - $_SESSION[self::SESSION_KEY][$id] = array( - 'id' => $id, - 'finished' => false, - 'percent' => 0, - 'total' => 0, - 'complete' => 0 - ); -} - -// retrieve the data from the session so it can be updated and returned -$ret = $_SESSION[self::SESSION_KEY][$id]; - // retrieve the upload data from APC -$status = apc_fetch('upload_' . $id); +$info = uploadprogress_get_info($id); // false is returned if the data isn't found -if ($status) { - $ret['finished'] = (bool) $status['done']; - $ret['total'] = $status['total']; - $ret['complete'] = $status['current']; - // calculate the completed percentage - if ($ret['total'] > 0) - $ret['percent'] = $ret['complete'] / $ret['total'] * 100; - // write the changed data back to the session - $_SESSION[self::SESSION_KEY][$id] = $ret; -} +if (!$info) { -if (!$ret) { - - if ( array_key_exists( "e", $_GET ) ) { - echo "Invalid Meter ID! {$_REQUEST['uploadid]}"; - echo (''); - exit; - } else { - echo (''); - exit; - } + echo "Could not locate progress {$id}. Trying again..."; + echo ""; + exit; } else { - if ($ret['percent'] > "99") { + if (intval($info['percent']) > "99") { - echo (' UPLOAD completed!'); + //echo (' UPLOAD completed!'); + echo (' UPLOAD completed!'); } else { @@ -115,7 +86,10 @@ if (!$ret) {
- ");?> + "; + ?>
@@ -124,20 +98,49 @@ if (!$ret) {
- - - - + + + + - - - - - -
Uploaded:File Size: + Uploaded: + + + + + + File Size: + + + +
Completed:%
- - - + + + Completed: + + + + % + + + + Estimated: + + + + + + + + + + + + -- cgit v1.1