Back to FtpClient class

Method _findMode

protected int
_findMode
(mixed $fileName)
Method to find out the correct transfer mode for a specific file
Parameters
  • string $fileName Name of the file
Returns
  • int Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
Since
  • 1.5
Class: FtpClient
Project: Joomla

Method _findMode - Source code

/**
 * Method to find out the correct transfer mode for a specific file
 *
 * @param   string  $fileName  Name of the file
 *
 * @return  integer Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
 *
 * @since   1.5
 */
protected function _findMode($fileName)
{
    if ($this->_type == FTP_AUTOASCII) {
        $dot = strrpos($fileName, '.') + 1;
        $ext = substr($fileName, $dot);
        if (\in_array($ext, $this->_autoAscii)) {
            $mode = FTP_ASCII;
        } else {
            $mode = FTP_BINARY;
        }
    } elseif ($this->_type == FTP_ASCII) {
        $mode = FTP_ASCII;
    } else {
        $mode = FTP_BINARY;
    }
    return $mode;
}