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.
21 function PMA_getUploadStatus($id)
26 if (trim($id) == "") {
30 if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
31 $_SESSION[$SESSION_KEY][$id] = array(
40 $ret = $_SESSION[$SESSION_KEY][$id];
42 if (! PMA_import_uploadprogressCheck() ||
$ret['finished']) {
46 $status = uploadprogress_get_info($id);
49 if ($status['bytes_uploaded'] == $status['bytes_total']) {
50 $ret['finished'] = true;
52 $ret['finished'] = false;
54 $ret['total'] = $status['bytes_total'];
55 $ret['complete'] = $status['bytes_uploaded'];
57 if ($ret['total'] > 0) {
58 $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
65 'total' => $ret['total'],
66 'complete' => $ret['total'],
71 $_SESSION[$SESSION_KEY][$id] = $ret;