Back to FtpClient class

Method _mode

protected bool
_mode
(mixed $mode)
Set transfer mode
Parameters
  • int $mode Integer representation of data transfer mode [1:Binary|0:Ascii] Defined constants can also be used [FTP_BINARY|FTP_ASCII]
Returns
  • bool True if successful
Since
  • 1.5
Class: FtpClient
Project: Joomla

Method _mode - Source code

/**
 * Set transfer mode
 *
 * @param   integer  $mode  Integer representation of data transfer mode [1:Binary|0:Ascii]
 * Defined constants can also be used [FTP_BINARY|FTP_ASCII]
 *
 * @return  boolean  True if successful
 *
 * @since   1.5
 */
protected function _mode($mode)
{
    if ($mode == FTP_BINARY) {
        if (!$this->_putCmd('TYPE I', 200)) {
            Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_MODE_BINARY', __METHOD__, $this->_response), Log::WARNING, 'jerror');
            return false;
        }
    } else {
        if (!$this->_putCmd('TYPE A', 200)) {
            Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_MODE_ASCII', __METHOD__, $this->_response), Log::WARNING, 'jerror');
            return false;
        }
    }
    return true;
}