FTP Library



( ZN >= 2.0.0 )

It is a class developed to manage files and folders more easily via FTP.

 

# Configuration


File: ( ZN FE ) Config / Filesystem.php
File: ( ZN OE ) Config / Services.php
FTP
String $ host = '' The host name to connect to.
String $ user = '' User name.
String $ password = '' User password.
Int $ timeout = 90 Connection timeout in seconds.
Int $ port = 21 Connection port.
Bool $ sslConnect = false Your connection will not be made with SSL .

 

# Methods


Bool createFolder ( String $ path )
Bool deleteFolder ( String $ path )
Bool changeFolder ( String $ path )
Bool rename ( String $ oldName , String $ newName )
Bool deleteFile ( String $ path )
float fileSize ( String $ path , String $ type = 'b' , Int $ decimal = 2 )
Bool download ( String $ remotePath , String $ localPath , String $ type = 'ascii' )
Bool upload ( String $ localPath , String $ remotePath , String $ type = 'ascii' )
Array files ( String $ path , String $ extension = NULL )
Bool permission ( String $ path , Int $ type = 0755 )
Object differentConnection ( Array $ config )

 

# CreateFolder ( ZN> = 2.0.0 )


Used to create an index.

Parameters

String $ path Directory path and name.
return Bool

uses

FTP::createFolder('path/NewFolder');

 

# DeleteFolder ( ZN> = 2.0.0 )


It can be used if there are no files or directories in the directory.

Parameters

String $ path Directory path and name.
return Bool

uses

FTP::deleteFolder('path/NewFolder');

 

# ChangeFolder ( ZN> = 2.0.0 )


Used to change the working directory.

Parameters

String $ path Directory path and name.
return Bool

uses

FTP::changeFolder('NewCurrentWorkingDir');

 

# Rename ( ZN >= 2.0.0 )


Used to change directory name.

Parameters

String $ Oldname Game Directory path and name.
String $ NewName The new directory name.
return Bool

uses

FTP::rename('path/OldFolder', 'path/NewFolder');

 

# DeleteFile ( ZN> = 2.0.0 )


Used to delete the file on the server.

Parameters

String $ path Directory path and name.
return Bool

uses

FTP::deleteFile('path/example.txt');

 

# FileSize ( ZN> = 2.0.0 )


Used to find the total size of the files in the server or files in a directory. Usage It has the same logic as Folder :: size () .

Parameters

String $ path Directory path and name.
String $ type = 'b' Output type.
Options b , kb , mb , gb
Int $ decimal = 2 Number of decimals.
return float

uses

\Output::writeLine( FTP::fileSize('path/example.txt') );
\Output::writeLine( FTP::fileSize('path/example.txt', 'kb') );
2048
2

 

# Download ( ZN >= 2.0.0


Used to download files from the server.

Parameters

String $ remotePath Server path.
String $ localPath Local road.
String $ type = 'ascii' Download type.
Options ascii , binary
return Bool

uses

FTP::download('htdocs/path/example.txt', 'C:/xampp7/htdocs');

 

# Upload ( ZN> = 2.0.0


Used to upload files to the server.

Parameters

String $ localPath Local road ..
String $ remotePath Server path.
String $ type = 'ascii' Download type.
Options ascii , binary
return Bool

uses

FTP::upload('C:/xampp7/htdocs/example.txt', 'htdocs/path');

 

# Files ( ZN> = 2.0.0


Used to get a list of all desired files and directories in the directory. Usage has the same logic as Folder :: files () .

Parameters

String $ path Directory path and name.
String $ extension = 'dir' Which extensions files will be listed.
return Array

uses

output( FTP::files('htdocs/path') );

 

# Permission ( ZN> = 2.0.0


Used to authorize the file on the server. Usage has the same logic as File :: permission () .

Parameters

String $ file File or directory path and name.
Int $ permission = 0755 The type of authority to be defined.
return Bool

uses

FTP::permission('htdocs/path/example.txt', 0777);

 

# DifferentConnection ( ZN> = 4.0.23


Used to create different set connections except for the connection provided with predefined settings.

Parameters

Array $ settings Settings.
return Object

uses

$conX = FTP::differentConnection(['host' => 'xhost', 'user' => 'xxx']);
$conY = FTP::differentConnection(['host' => 'yhost', 'user' => 'yyy']);

output($conX->files('htdocs/path'));
output($conY->files('htdocs/path'));