Back to FtpClient class

Method _putCmd

protected bool
_putCmd
(mixed $cmd, mixed $expectedResponse)
Send command to the FTP server and validate an expected response code
Parameters
  • string $cmd Command to send to the FTP server
  • mixed $expectedResponse Integer response code or array of integer response codes
Returns
  • bool True if command executed successfully
Since
  • 1.5
Class: FtpClient
Project: Joomla

Method _putCmd - Source code

/**
 * Send command to the FTP server and validate an expected response code
 *
 * @param   string  $cmd               Command to send to the FTP server
 * @param   mixed   $expectedResponse  Integer response code or array of integer response codes
 *
 * @return  boolean  True if command executed successfully
 *
 * @since   1.5
 */
protected function _putCmd($cmd, $expectedResponse)
{
    // Make sure we have a connection to the server
    if (!\is_resource($this->_conn)) {
        Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_PUTCMD_UNCONNECTED', __METHOD__), Log::WARNING, 'jerror');
        return false;
    }
    // Send the command to the server
    if (!fwrite($this->_conn, $cmd . "\r\n")) {
        Log::add(Text::sprintf('DDD', Text::sprintf('JLIB_CLIENT_ERROR_FTP_PUTCMD_SEND', __METHOD__, $cmd)), Log::WARNING, 'jerror');
    }
    return $this->_verifyResponse($expectedResponse);
}