public static function uniqueFilename($filename, $path) {
	
		// fixes path if not containing trailing slash
		self::fixTrailingSlash($path);
	
		if (file_exists($path . $filename)) {
			$dot  = strrpos($filename,'.');
			$ext  = substr($filename,$dot);
			$name = substr($filename,0,$dot);
			$hash = substr(md5(time()),0,6);
			$filename = $name . '-' . $hash . $ext;
		}
	
		return $filename;
	
	}
public static function uniqueFilename($filename, $path) {
	
		// fixes path if not containing trailing slash
		self::fixTrailingSlash($path);
	
		if (file_exists($path . $filename)) {
			$dot  = strrpos($filename,'.');
			$ext  = substr($filename,$dot);
			$name = substr($filename,0,$dot);
			$hash = substr(md5(time()),0,6);
			$filename = $name . '-' . $hash . $ext;
		}
	
		return $filename;
	
	}
public static function uniqueFilename ( $ filename , $ path ) { // fixes path if not containing trailing slash
 self :: fixTrailingSlash ( $ path ) ; if ( file_exists ( $ path . $ filename ) ) { $ dot = strrpos ( $ filename , '.' ) ; $ ext = substr ( $ filename , $ dot ) ; $ name = substr ( $ filename , 0 , $ dot ) ; $ hash = substr ( md5 ( time ( ) ) , 0 , 6 ) ; $ filename = $ name . '-' . $ hash . $ ext ; } return $ filename ; }
Rename a file if another with same name exists, adding hash of current date. It keep safe
the filename extension.

@param	string	Original file-name with or without extension.
@param	string	Path to file, with or without trailing slash.

@return	string
Rename a file if another with same name exists adding hash of current date . It keep safe the filename extension .