From a93461b231fb94f3a6a9df09a30557732201ddcc Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 14 Oct 2013 16:06:56 +0000 Subject: added new EasyGiant Library --- h-source/Library/Files/Upload.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'h-source/Library/Files') diff --git a/h-source/Library/Files/Upload.php b/h-source/Library/Files/Upload.php index 7dbc7d1..00a0afe 100755 --- a/h-source/Library/Files/Upload.php +++ b/h-source/Library/Files/Upload.php @@ -230,7 +230,8 @@ class Files_Upload { if (strstr($file,'.')) { - return strtolower(end(explode('.', $file))); + $extArray = explode('.', $file); + return strtolower(end($extArray)); } return ''; } @@ -268,6 +269,23 @@ class Files_Upload } + //get a not existing folder name + public function getUniqueFolderName($folder,$int = 0) + { + $token = $int === 0 ? null : $this->params['fileUploadBeforeTokenChar'].$int; + + $newName = $folder.$token; + if (!is_dir($this->base.$this->directory.$newName)) + { + return $newName; + } + else + { + return $this->getUniqueFolderName($folder,$int+1); + } + + } + protected function parentDir() { #individuo la cartella madre $folders = explode(self::DS,$this->directory); @@ -333,7 +351,7 @@ class Files_Upload } //check if the $name folder is empty or not - protected function isEmpty($name) + public function isEmpty($name) { $items = scandir($name); foreach( $items as $this_file ) { -- cgit v1.2.3