From 40bfe1f97897e11545b6446bc3fe96f8d38c4344 Mon Sep 17 00:00:00 2001 From: alec Date: Sat, 5 Sep 2009 07:47:07 +0000 Subject: - Check 'post_max_size' for upload max filesize (#1486089) git-svn-id: https://svn.roundcube.net/trunk@2926 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/steps/mail/attachments.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'roundcubemail/program/steps/mail/attachments.inc') diff --git a/roundcubemail/program/steps/mail/attachments.inc b/roundcubemail/program/steps/mail/attachments.inc index 601570345..b57037d05 100644 --- a/roundcubemail/program/steps/mail/attachments.inc +++ b/roundcubemail/program/steps/mail/attachments.inc @@ -128,7 +128,13 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { } } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $OUTPUT->command('display_message', rcube_label('fileuploaderror'), 'error'); + // if filesize exceeds post_max_size then $_FILES array is empty, + // show filesizeerror instead of fileuploaderror + if ($maxsize = ini_get('post_max_size')) + $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes($maxsize))))); + else + $msg = rcube_label('fileuploaderror'); + $OUTPUT->command('display_message', $msg, 'error'); } // send html page with JS calls as response -- cgit v1.2.3