From 25310c05ab838eef5458b222bf5f243f910392c2 Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Wed, 03 Jan 2018 17:36:05 +0100
Subject: [PATCH] Gestione delle dimenzioni utilizzando il metodo di conversione da stringa.

---
 src/UploadFile/SetupUpload.class.php |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/UploadFile/SetupUpload.class.php b/src/UploadFile/SetupUpload.class.php
index e21e31d..8bd941a 100644
--- a/src/UploadFile/SetupUpload.class.php
+++ b/src/UploadFile/SetupUpload.class.php
@@ -56,8 +56,16 @@
         return $this->sizeLimitFileUpload;
     }
 
+    /**
+     * Dimensione massima del singolo file caricato
+     * 
+     * Accetta sia '1024' che '1 kb' effettuando la conversione interna 
+     * necessaria.
+     * @param string $x sia '1024' che '1 kb'
+     * @return \SetupUpload
+     */
     public function setSizeLimitFile($x) {
-        $this->sizeLimitFileUpload = $x;
+        $this->sizeLimitFileUpload = self::str2Bytes($x);
         return $this;
     }
 
@@ -122,10 +130,10 @@
      * @return \SetupUpload fluent style
      */
     public function setNumMaxFiles($numero) {
-        if(!is_integer($numero) || $numero <= 0){
+        if (!is_integer($numero) || $numero <= 0) {
             throw new UploadFile_Exc();
-        } 
-        
+        }
+
         $this->numMaxFiles = $numero;
         return $this;
     }
@@ -134,8 +142,16 @@
         return $this->sizeMaxFilesByte;
     }
 
+    /**
+     * Dimensione Totale massima dei file caricabili
+     * 
+     * Accetta sia '1024' che '1 kb' effettuando la conversione interna 
+     * necessaria.
+     * @param string $x sia '1024' che '1 kb'
+     * @return \SetupUpload
+     */
     public function setSizeMaxFilesByte($x) {
-        $this->sizeMaxFilesByte = $x;
+        $this->sizeMaxFilesByte = self::str2Bytes($x);
         return $this;
     }
 

--
Gitblit v1.8.0