diff options
Diffstat (limited to 'h-source/Library/Files')
-rwxr-xr-x | h-source/Library/Files/Upload.php | 22 |
1 files changed, 20 insertions, 2 deletions
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 ) { |