API16

JFTP/delete

From Joomla! Documentation

< API16:JFTP
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Method to delete a path [file/folder] on the FTP server


<! removed transcluded page call, red link never existed >

Syntax[edit]

delete($path)
Parameter Name Default Value Description
$path $path Path to delete

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/client/ftp.php

Importing[edit]

jimport( 'joomla.client.ftp' );

Source Body[edit]

function delete($path) {

        // If native FTP support is enabled lets use it...
        if (FTP_NATIVE) {
                if (@ftp_delete($this->_conn, $path) === false) {
                        if (@ftp_rmdir($this->_conn, $path) === false) {
                                JError::raiseWarning('35', 'JFTP::delete: Bad response');
                                return false;
                        }
                }
                return true;
        }

        // Send delete file command and if that doesn't work, try to remove a directory
        if (!$this->_putCmd('DELE '.$path, 250)) {
                if (!$this->_putCmd('RMD '.$path, 250)) {
                        JError::raiseWarning('35', 'JFTP::delete: Bad response', 'Server response: '.$this->_response.' [Expected: 250] Path sent: '.$path);
                        return false;
                }
        }
        return true;
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]