includes/php/upload.php
/**
	 * Check if a file exits or not and calculates a new name for not oovverring other files
	 * @param string $upload_path
	 */
Check if a file exits or not and calculates a new name for not oovverring other files
@param string $upload_path
Check if a file exits or not and calculates a new name for not oovverring other files @param string $upload_path
private function checkFileExits($upload_path='')
	{
		if($upload_path=='') $upload_path = $this->upload_path;
		if(!$this->override)
		{
			usleep(rand(100, 900));
			$filename 		= $this->file_name;
			$file_data 	= pathinfo($filename);
			$file_base	= $file_data['filename'];
			$file_ext	= $file_data['extension'];
			$c=0;
			while(file_exists($upload_path.$filename))
			{
				$find = preg_match('/\((.*?)\)/', $filename, $match);
				if(!$find) $match[1] = 0;
				else
					$file_base = str_replace("(".$match[1].")", "", $file_base);
				$match[1]++;
				$filename	= $file_base."(".$match[1].").".$file_ext;
			}
			$this->file_name = $filename;
		}
	}
private function checkFileExits ( $ upload_path = '' ) { if ( $ upload_path == '' ) $ upload_path = $ this -> upload_path ; if ( ! $ this -> override ) { usleep ( rand ( 100 , 900 ) ) ; $ filename = $ this -> file_name ; $ file_data = pathinfo ( $ filename ) ; $ file_base = $ file_data [ 'filename' ] ; $ file_ext = $ file_data [ 'extension' ] ; $ c = 0 ; while ( file_exists ( $ upload_path . $ filename ) ) { $ find = preg_match ( '/\((.*?)\)/' , $ filename , $ match ) ; if ( ! $ find ) $ match [ 1 ] = 0 ; else $ file_base = str_replace ( " ( " . $ match [ 1 ] . " ) " , " " , $ file_base ) ; $ match [ 1 ] ++ ; $ filename = $ file_base . " ( " . $ match [ 1 ] . " ). " . $ file_ext ; } $ this -> file_name = $ filename ; } }
Check if a file exits or not and calculates a new name for not oovverring other files
 @param string $upload_path
Check if a file exits or not and calculates a new name for not oovverring other files @param string $upload_path
//$upload_path 	= $this->upload_path; //PHP 5.2> //Disable this lines of code to allow file override // end