public static function valid($filename = null)
	{
		if (!$filename)
		{
			return false;
		}

		if (preg_match("/^\s*http[s]{0,1}:/i", $filename))
		{
			return false;
		}
		if (preg_match("/^\s*[\/]{0,1}index.php\?/i", $filename))
		{
			return false;
		}
		// Disallow windows drive letter
		if (preg_match("/^\s*[.]:/", $filename))
		{
			return false;
		}
		// Disallow \
		if (strpos($filename, '\\'))
		{
			return false;
		}
		// Disallow ..
		if (strpos($filename, '..'))
		{
			return false;
		}

		return true;
	}
public static function valid($filename = null)
	{
		if (!$filename)
		{
			return false;
		}

		if (preg_match("/^\s*http[s]{0,1}:/i", $filename))
		{
			return false;
		}
		if (preg_match("/^\s*[\/]{0,1}index.php\?/i", $filename))
		{
			return false;
		}
		// Disallow windows drive letter
		if (preg_match("/^\s*[.]:/", $filename))
		{
			return false;
		}
		// Disallow \
		if (strpos($filename, '\\'))
		{
			return false;
		}
		// Disallow ..
		if (strpos($filename, '..'))
		{
			return false;
		}

		return true;
	}
public static function valid ( $ filename = null ) { if ( ! $ filename ) { return false ; } if ( preg_match ( "/^\s*http[s]{0,1}:/i" , $ filename ) ) { return false ; } if ( preg_match ( "/^\s*[\/]{0,1}index.php\?/i" , $ filename ) ) { return false ; } // Disallow windows drive letter if ( preg_match ( "/^\s*[.]:/" , $ filename ) ) { return false ; } // Disallow \ if ( strpos ( $ filename , '\\' ) ) { return false ; } // Disallow .. if ( strpos ( $ filename , '..' ) ) { return false ; } return true ; }
Set the filename value

@param   string   $filename  File to serve up
@return  boolean  True if path is allowable, False if not
Set the filename value