diff options
| author | Antonio Gallo <tonicucoz@gmail.com> | 2013-10-14 16:06:56 +0000 | 
|---|---|---|
| committer | Antonio Gallo <tonicucoz@gmail.com> | 2013-10-14 16:06:56 +0000 | 
| commit | a93461b231fb94f3a6a9df09a30557732201ddcc (patch) | |
| tree | f278951ee7746da2a618ec57043c57fafe779c1d /h-source/Library/Files | |
| parent | 6fa0219202ce4ccc5c4592e66031bb0f7f8be2b0 (diff) | |
added new EasyGiant Library
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 ) {  | 
