2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 if (! defined('PHPMYADMIN')) {
12 $ID_KEY = "UPLOAD_IDENTIFIER";
15 * Returns upload status.
17 * This is implementation for uploadprogress extension.
19 function PMA_getUploadStatus($id) {
23 if (trim($id) == "") {
27 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
28 $_SESSION[$SESSION_KEY][$id] = array(
37 $ret = $_SESSION[$SESSION_KEY][$id];
39 if (! PMA_import_uploadprogressCheck() ||
$ret['finished']) {
43 $status = uploadprogress_get_info($id);
46 if ($status['bytes_uploaded'] == $status['bytes_total']) {
47 $ret['finished'] = true;
49 $ret['finished'] = false;
51 $ret['total'] = $status['bytes_total'];
52 $ret['complete'] = $status['bytes_uploaded'];
54 if ($ret['total'] > 0) {
55 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
62 'total' => $ret['total'],
63 'complete' => $ret['total'],
68 $_SESSION[$SESSION_KEY][$id] = $ret;