2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 if (! defined('PHPMYADMIN')) {
11 $ID_KEY = "UPLOAD_IDENTIFIER";
14 * Returns upload status.
16 * This is implementation for uploadprogress extension.
18 function PMA_getUploadStatus($id) {
22 if (trim($id) == "") {
26 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
27 $_SESSION[$SESSION_KEY][$id] = array(
36 $ret = $_SESSION[$SESSION_KEY][$id];
38 if (! PMA_import_uploadprogressCheck() ||
$ret['finished']) {
42 $status = uploadprogress_get_info($id);
45 if ($status['bytes_uploaded'] == $status['bytes_total']) {
46 $ret['finished'] = true;
48 $ret['finished'] = false;
50 $ret['total'] = $status['bytes_total'];
51 $ret['complete'] = $status['bytes_uploaded'];
53 if ($ret['total'] > 0) {
54 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
61 'total' => $ret['total'],
62 'complete' => $ret['total'],
67 $_SESSION[$SESSION_KEY][$id] = $ret;