API15

API15:JFTP/delete

From Joomla! Documentation

Revision as of 22:13, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Method to delete a path [file/folder] on the FTP server <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JFTP/delete|Edit Descripton...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

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

[Edit Descripton]

Template:Description:JFTP/delete

Syntax

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

Returns

boolean True if successful

Defined in

libraries/joomla/client/ftp.php

Importing

jimport( 'joomla.client.ftp' );

Source Body

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;
}

[Edit See Also] Template:SeeAlso:JFTP/delete

Examples

<CodeExamplesForm />