summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-08-16 12:11:21 +0000
committeralecpl <alec@alec.pl>2011-08-16 12:11:21 +0000
commitfe0cb657f1b3c0a5b097a4f7a2b670ea8c52997b (patch)
tree9c71d5b15da006ccc2289c03b4ed0e1b2a2be3bd /program/include/main.inc
parentfaf10e8fec3dcd4439a3a22cb2e3877c4b622b33 (diff)
- Add client-side checking of uploaded files size
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc15
1 files changed, 14 insertions, 1 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index d43f8ea50..a3edbf7ca 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -2332,7 +2332,7 @@ function rcube_upload_progress()
$RCMAIL->output->send();
}
-function rcube_upload_progress_init()
+function rcube_upload_init()
{
global $RCMAIL;
@@ -2343,6 +2343,19 @@ function rcube_upload_progress_init()
$RCMAIL->output->set_env('upload_progress_time', (int) $seconds);
}
}
+
+ // find max filesize value
+ $max_filesize = parse_bytes(ini_get('upload_max_filesize'));
+ $max_postsize = parse_bytes(ini_get('post_max_size'));
+ if ($max_postsize && $max_postsize < $max_filesize)
+ $max_filesize = $max_postsize;
+
+ $RCMAIL->output->set_env('max_filesize', $max_filesize);
+ $max_filesize = show_bytes($max_filesize);
+ $RCMAIL->output->set_env('filesizeerror', rcube_label(array(
+ 'name' => 'filesizeerror', 'vars' => array('size' => $max_filesize))));
+
+ return $max_filesize;
}
/**