Overview

Packages

  • FTPClient

Classes

  • FTPClient
  • Overview
  • Package
  • Class
  • Tree

Class FTPClient

FTP Client for PHP

Package: FTPClient
Copyright: Melih Ucar
License: (The MIT License) Copyright (c) 2013, Melih Ucar (http://www.melihucar.net/) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author: Melih Ucar
Version: 1.0
Located at ftpclient.php
Methods summary
public
# FTPClient( )

Constructor

Constructor

Checks if ftp extension is loaded.

public FTPClient
# connect( string $host, boolean $ssl = false, integer $port = 21, integer $timeout = 90 )

Opens a FTP connection

Opens a FTP connection

Parameters

$host
string
$host
$ssl
boolean
$ssl
$port
integer
$port
$timeout
integer
$timeout

Returns

FTPClient
public FTPClient
# login( string $username = 'anonymous', string $password = '' )

Logins to FTP Server

Logins to FTP Server

Parameters

$username
string
$username
$password
string
$password

Returns

FTPClient
public
# close( )

Closes FTP connection

Closes FTP connection

public FTPClient,
# passive( boolean $passive = true )

Changes passive mode,,,

Changes passive mode,,,

Parameters

$passive
boolean
$passive

Returns

FTPClient,
public FTPClient
# changeDirectory( mixed $directory )

Changes the current directory to the specified one

Changes the current directory to the specified one

Returns

FTPClient
public FTPClient
# parentDirectory( )

Changes to the parent directory

Changes to the parent directory

Returns

FTPClient
public string
# getDirectory( )

Returns the current directory name

Returns the current directory name

Returns

string
public FTPClient
# createDirectory( string $directory )

Creates a directory

Creates a directory

Parameters

$directory
string
$directory

Returns

FTPClient
public FTPClient
# removeDirectory( string $directory )

Removes a directory

Removes a directory

Parameters

$directory
string
$directory

Returns

FTPClient
public array
# listDirectory( string $directory )

Returns a list of files in the given directory

Returns a list of files in the given directory

Parameters

$directory
string
$directory

Returns

array
public FTPClient
# delete( string $path )

Deletes a file on the FTP server

Deletes a file on the FTP server

Parameters

$path
string
$path

Returns

FTPClient
public integer
# size( string $remoteFile )

Returns the size of the given file. Return -1 on error

Returns the size of the given file. Return -1 on error

Parameters

$remoteFile
string
$remoteFile

Returns

integer
public integer
# modifiedTime( string $remoteFile, mixed $format = null )

Returns the last modified time of the given file. Return -1 on error

Returns the last modified time of the given file. Return -1 on error

Parameters

$remoteFile
string
$remoteFile
$format

Returns

integer
public boolean
# rename( string $currentName, string $newName )

Renames a file or a directory on the FTP server

Renames a file or a directory on the FTP server

Parameters

$currentName
string
$currentName
$newName
string
$newName

Returns

boolean
public FTPClient
# get( string $localFile, string $remoteFile, integer $mode = FTPClient::ASCII, integer $resumePosision = 0 )

Downloads a file from the FTP server

Downloads a file from the FTP server

Parameters

$localFile
string
$localFile
$remoteFile
string
$remoteFile
$mode
integer
$mode
$resumePosision
integer
$resumepos

Returns

FTPClient
public FTPClient
# put( string $remoteFile, string $localFile, integer $mode = FTPClient::ASCII, integer $startPosision = 0 )

Uploads from an open file to the FTP server

Uploads from an open file to the FTP server

Parameters

$remoteFile
string
$remoteFile
$localFile
string
$localFile
$mode
integer
$mode
$startPosision
integer
$startPosision

Returns

FTPClient
public FTPClient
# fget( resource $handle, string $remoteFile, integer $mode = FTPClient::ASCII, integer $resumePosision = 0 )

Downloads a file from the FTP server and saves to an open file

Downloads a file from the FTP server and saves to an open file

Parameters

$handle
resource
$handle
$remoteFile
string
$remoteFile
$mode
integer
$mode
$resumePosision
integer
$resumepos

Returns

FTPClient
public FTPClient
# fput( string $remoteFile, resource $handle, integer $mode = FTPClient::ASCII, integer $startPosision = 0 )

Uploads from an open file to the FTP server

Uploads from an open file to the FTP server

Parameters

$remoteFile
string
$remoteFile
$handle
resource
$handle
$mode
integer
$mode
$startPosision
integer
$startPosision

Returns

FTPClient
public mixed
# getOption( mixed $option )

Retrieves various runtime behaviours of the current FTP stream TIMEOUT_SEC | AUTOSEEK

Retrieves various runtime behaviours of the current FTP stream TIMEOUT_SEC | AUTOSEEK

Parameters

$option
mixed
$option

Returns

mixed
public mixed
# setOption( mixed $option, mixed $value )

Set miscellaneous runtime FTP options TIMEOUT_SEC | AUTOSEEK

Set miscellaneous runtime FTP options TIMEOUT_SEC | AUTOSEEK

Parameters

$option
mixed
$option
$value
mixed
$value

Returns

mixed
public FTPClient
# allocate( integer $filesize )

Allocates space for a file to be uploaded

Allocates space for a file to be uploaded

Parameters

$filesize
integer
$filesize

Returns

FTPClient
public FTPClient
# chmod( integer $mode, string $filename )

Set permissions on a file via FTP

Set permissions on a file via FTP

Parameters

$mode
integer
$mode
$filename
string
$filename

Returns

FTPClient
public FTPClient
# exec( string $command )

Requests execution of a command on the FTP server

Requests execution of a command on the FTP server

Parameters

$command
string
$command

Returns

FTPClient
public
# __destruct( )

Destructor

Destructor

Constants summary
integer ASCII FTP_ASCII
#
integer BINARY FTP_BINARY
#
integer TIMEOUT_SEC FTP_TIMEOUT_SEC
#
integer AUTOSEEK FTP_AUTOSEEK
#
API documentation generated by ApiGen 2.8.0