Back to FtpClient class

Method mkdir

public bool
mkdir
(mixed $path)
Method to create a directory on the FTP server
Parameters
  • string $path Directory to create
Returns
  • bool True if successful
Since
  • 1.5
Class: FtpClient
Project: Joomla

Method mkdir - Source code

/**
 * Method to create a directory on the FTP server
 *
 * @param   string  $path  Directory to create
 *
 * @return  boolean  True if successful
 *
 * @since   1.5
 */
public function mkdir($path)
{
    // If native FTP support is enabled let's use it...
    if (FTP_NATIVE) {
        if (@ftp_mkdir($this->_conn, $path) === false) {
            Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_BAD_RESPONSE', __METHOD__), Log::WARNING, 'jerror');
            return false;
        }
        return true;
    }
    // Send change directory command and verify success
    if (!$this->_putCmd('MKD ' . $path, 257)) {
        Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_NOT_EXPECTED_RESPONSE_PATH_SENT', __METHOD__, $this->_response, 257, $path), Log::WARNING, 'jerror');
        return false;
    }
    return true;
}