src/Clients/FtpClient.php
public function chmod($path, $mode)
	{
		// If no filename is given, we assume the current directory is the target
		if ($path == '')
		{
			$path = '.';
		}

		// Convert the mode to a string
		if (\is_int($mode))
		{
			$mode = decoct($mode);
		}

		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_site($this->conn, 'CHMOD ' . $mode . ' ' . $path) === false)
			{
				if (!\defined('PHP_WINDOWS_VERSION_MAJOR'))
				{
					throw new FilesystemException(__METHOD__ . 'Bad response.');
				}

				return false;
			}

			return true;
		}

		// Send change mode command and verify success [must convert mode from octal]
		if (!$this->_putCmd('SITE CHMOD ' . $mode . ' ' . $path, array(200, 250)))
		{
			if (!\defined('PHP_WINDOWS_VERSION_MAJOR'))
			{
				throw new FilesystemException(
					sprintf(
						'%1$s: Bad response.  Server response: %2$s [Expected: 250].  Path sent: %3$s.  Mode sent: %4$s',
						__METHOD__,
						$this->response,
						$path,
						$mode
					)
				);
			}

			return false;
		}

		return true;
	}
public function chmod($path, $mode)
	{
		// If no filename is given, we assume the current directory is the target
		if ($path == '')
		{
			$path = '.';
		}

		// Convert the mode to a string
		if (\is_int($mode))
		{
			$mode = decoct($mode);
		}

		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_site($this->conn, 'CHMOD ' . $mode . ' ' . $path) === false)
			{
				if (!\defined('PHP_WINDOWS_VERSION_MAJOR'))
				{
					throw new FilesystemException(__METHOD__ . 'Bad response.');
				}

				return false;
			}

			return true;
		}

		// Send change mode command and verify success [must convert mode from octal]
		if (!$this->_putCmd('SITE CHMOD ' . $mode . ' ' . $path, array(200, 250)))
		{
			if (!\defined('PHP_WINDOWS_VERSION_MAJOR'))
			{
				throw new FilesystemException(
					sprintf(
						'%1$s: Bad response.  Server response: %2$s [Expected: 250].  Path sent: %3$s.  Mode sent: %4$s',
						__METHOD__,
						$this->response,
						$path,
						$mode
					)
				);
			}

			return false;
		}

		return true;
	}
public function chmod ( $ path , $ mode ) { // If no filename is given, we assume the current directory is the target if ( $ path == '' ) { $ path = '.' ; } // Convert the mode to a string if ( \ is_int ( $ mode ) ) { $ mode = decoct ( $ mode ) ; } // If native FTP support is enabled let's use it... if ( FTP_NATIVE ) { if ( @ ftp_site ( $ this -> conn , 'CHMOD ' . $ mode . ' ' . $ path ) === false ) { if ( ! \ defined ( 'PHP_WINDOWS_VERSION_MAJOR' ) ) { throw new FilesystemException ( __METHOD__ . 'Bad response.' ) ; } return false ; } return true ; } // Send change mode command and verify success [must convert mode from octal] if ( ! $ this -> _putCmd ( 'SITE CHMOD ' . $ mode . ' ' . $ path , array ( 200 , 250 ) ) ) { if ( ! \ defined ( 'PHP_WINDOWS_VERSION_MAJOR' ) ) { throw new FilesystemException ( sprintf ( '%1$s: Bad response.  Server response: %2$s [Expected: 250].  Path sent: %3$s.  Mode sent: %4$s' , __METHOD__ , $ this -> response , $ path , $ mode ) ) ; } return false ; } return true ; }
Method to change mode for a path on the FTP server

@param   string  $path  Path to change mode on
@param   mixed   $mode  Octal value to change mode to, e.g. '0777', 0777 or 511 (string or integer)

@return  boolean  True if successful

@since   1.0
@throws  FilesystemException
Method to change mode for a path on the FTP server