Explorar el Código

[GENERIC] Zend_Form_Element_File:

- made ini settings error more descriptive
- fixed memory limit for huge uploads

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15767 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas hace 16 años
padre
commit
a583aac6ca
Se han modificado 1 ficheros con 3 adiciones y 14 borrados
  1. 3 14
      library/Zend/Form/Element/File.php

+ 3 - 14
library/Zend/Form/Element/File.php

@@ -589,17 +589,12 @@ class Zend_Form_Element_File extends Zend_Form_Element_Xhtml
     {
         if (self::$_maxFileSize < 0) {
             $ini = $this->_convertIniToInteger(trim(ini_get('post_max_size')));
-            $mem = $this->_convertIniToInteger(trim(ini_get('memory_limit')));
             $max = $this->_convertIniToInteger(trim(ini_get('upload_max_filesize')));
-            $min = max($ini, $mem, $max);
+            $min = max($ini, $max);
             if ($ini > 0) {
                 $min = min($min, $ini);
             }
 
-            if ($mem > 0) {
-                $min = min($min, $mem);
-            }
-
             if ($max > 0) {
                 $min = min($min, $max);
             }
@@ -619,24 +614,18 @@ class Zend_Form_Element_File extends Zend_Form_Element_Xhtml
     public function setMaxFileSize($size)
     {
         $ini = $this->_convertIniToInteger(trim(ini_get('post_max_size')));
-        $mem = $this->_convertIniToInteger(trim(ini_get('memory_limit')));
         $max = $this->_convertIniToInteger(trim(ini_get('upload_max_filesize')));
 
         if (($max > -1) && ($size > $max)) {
-            trigger_error("Your 'upload_max_filesize' config setting allows only $max. You set $size.", E_USER_NOTICE);
+            trigger_error("Your 'upload_max_filesize' config setting limits the maximum filesize to '$max'. You tried to set '$size'.", E_USER_NOTICE);
             $size = $max;
         }
 
         if (($ini > -1) && ($size > $ini)) {
-            trigger_error("Your 'post_max_size' config setting allows only $ini. You set $size.", E_USER_NOTICE);
+            trigger_error("Your 'post_max_size' config setting limits the maximum filesize to '$ini'. You tried to set '$size'.", E_USER_NOTICE);
             $size = $ini;
         }
 
-        if (($mem > -1) && ($size > $mem)) {
-            trigger_error("Your 'memory_limit' config setting allows only $mem. You set $size.", E_USER_NOTICE);
-            $size = $mem;
-        }
-
         self::$_maxFileSize = $size;
         return $this;
     }