API15

JFTP/delete: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 62: Line 62:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=delete
  category=delete
  category=JFTP
  category=JFTP
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:36, 25 March 2017

Description

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

[<! removed edit link to red link >]

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

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

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples