From fe0cb657f1b3c0a5b097a4f7a2b670ea8c52997b Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 16 Aug 2011 08:11:21 -0400
Subject: [PATCH] - Add client-side checking of uploaded files size

---
 program/steps/mail/compose.inc |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 31de0d9..9a94ff7 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1206,20 +1206,11 @@
   if (!$attrib['id'])
     $attrib['id'] = 'rcmUploadbox';
 
-  // Enable upload progress bar
-  rcube_upload_progress_init();
+  // Get filesize, enable upload progress bar
+  $max_filesize = rcube_upload_init();
 
-  // 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;
-
-  $OUTPUT->set_env('max_filesize', $max_filesize);
-  $max_filesize = show_bytes($max_filesize);
-  
   $button = new html_inputfield(array('type' => 'button'));
-  
+
   $out = html::div($attrib,
     $OUTPUT->form_tag(array('name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'),
       html::div(null, rcmail_compose_attachment_field(array('size' => $attrib['attachmentfieldsize']))) .
@@ -1230,7 +1221,7 @@
       )
     )
   );
-  
+
   $OUTPUT->add_gui_object('uploadbox', $attrib['id']);
   return $out;
 }

--
Gitblit v1.9.1