public
|
#
__construct( string $server, string $user = 'anonymous', string $password = 'nobody@nobody.com', integer $port = 21 )
Construct a new FTP client object and set the server information.
Construct a new FTP client object and set the server information.
Parameters
- $server
- The FTP server to connect to.
- $user
- The name of the user to authenticate with.
- $password
- The password for the above user.
- $port
- The port to connect to on the server.
|
public
integer
|
#
getTransferType( string $file )
Get the transfer type based on the file extension.
Get the transfer type based on the file extension.
Parameters
- $file
- The file name to guess the transfer type from.
Returns
integer The data type either ASCII or BINARY (the default)
|
public
boolean
|
#
connect( )
Connect to the FTP server, login and set to binary mode.
Connect to the FTP server, login and set to binary mode.
Returns
boolean Returns if the connection to the server was made, true, or failed, false.
|
public
|
#
close( )
Close the open connection.
Close the open connection.
|
public
boolean
|
#
createFolder( string $path )
Make a new folder on the FTP server.
Make a new folder on the FTP server.
Parameters
- $path
- The path to the folder on the FTP server
Returns
boolean Flags if the directory was created or not.
|
public
boolean
|
#
deleteFolder( string $path )
Delete a folder on the FTP server.
Delete a folder on the FTP server.
Parameters
- $path
- The path to the folder to delete.
Returns
boolean Flags if the directory was deleted or not.
|
public
boolean
|
#
rename( string $from, string $to )
Rename a file or folder on the FTP server.
Rename a file or folder on the FTP server.
Parameters
- $from
- The file or folder to rename.
- $to
- The new name of the file or folder.
Returns
boolean Flags if the file or folder was renamed or not.
|
public
boolean
|
#
delete( string $file )
Delete a file from the FTP server.
Delete a file from the FTP server.
Parameters
- $file
- The name of the file to delete.
Returns
boolean Flags if the file was deleted or not.
|
public
boolean
|
#
putFile( string $file, string $src, boolean $fromFile = true, integer $mode = flFtpClient::AUTO )
Upload data to a file on the FTP server.
Upload data to a file on the FTP server.
Parameters
- $file
- The file to store the data as.
- $src
- The data to upload or the name of the file to upload.
- $fromFile
- true if $src is the name of the file to upload or false if it is the data.
- $mode
- The transfer mode.
Returns
boolean Flags if the file was written or not.
|
public
mixed
|
#
getFile( string $file, string $store = null, integer $mode = flFtpClient::AUTO )
Download a file from the FTP server.
Download a file from the FTP server.
Parameters
- $file
- The name of the file to download.
- $store
- The name of the file to store the download to or null to keep it in memory.
- $mode
- The transfer mode.
Returns
mixed If $store is null then the file contents are returned, else true or false is returned.
|
public
boolean
|
#
changeFolder( string $path )
Set the currect folder for operations.
Set the currect folder for operations.
Parameters
- $path
- The new path to work in.
Returns
boolean Flags if the was changed or not.
|
public
boolean
|
#
changeToParentFolder( )
Set the currect folder for operations to the parent folder.
Set the currect folder for operations to the parent folder.
Returns
boolean Flags if the was changed or not.
|
public
boolean
|
#
chmod( string $file, integer $perms )
Set the permissions for the named file.
Set the permissions for the named file.
Parameters
- $file
- The file to change the permissions for.
- $perms
The octal permission numbers 0000 to 0777, e.g. 0664 = u,rw g,rw o,r
- 1 = Execute
- 2 = Write
- 3 = Read
Returns
boolean Flags if the was changed or not.
|
public
string
|
#
currentFolder( )
Get the current folder.
Returns
string The current folder or false.
|
public
boolean
|
#
isFolder( string $path )
Test if the path is a folder.
Test if the path is a folder.
Parameters
Returns
boolean true if the path is a folder; else false.
|
public
array
|
#
listFiles( string $path = '.' )
Get a list of the files and folders.
Get a list of the files and folders.
Parameters
- $path
- The path to get the file and folders from.
Returns
array List of the files and folders within the given director.
|