files

Files Class provided by System to register folders and serve files.

package

SYSTEM\FILES

Methods

Delete a File

delete(string $cat, string $id) : boolean
static

Arguments

$cat

string

Category of the File

$id

string

ID of the File

Response

boolean

Returns true or false or throws an Error.

Returns Chunks of a File Callback: function($chunk,&$handle,$iteration)

file_get_contents_chunked(string $file, integer $chunk_size, \SYSTEM\FILES\function $callback) : boolean
static

Arguments

$file

string

Path of the File

$chunk_size

integer

Size of the Chunks

$callback

\SYSTEM\FILES\function

Callback function which is called for every chunk

Response

boolean

Returns true.

Retrieve a File

get(string $cat = null, string $id = null, boolean $returnasjson = false) : mixed
static

Arguments

$cat

string

Category to query or null

$id

string

File to query or null

$returnasjson

boolean

Determines if you recieve Arrays or JSON results

Response

mixed

Returns List of Folders if cat is null, List of Files of id is null or Streams the requested File.

Returns the contents of a Folder

getFolder(string $folder) : array
static

Arguments

$folder

string

Path to the Folder

Response

array

Returns a list of Files in the directory.

Returns a URL for a File

getURL(string $cat, string $id = null) : string
static

Arguments

$cat

string

Category of the File

$id

string

ID of the File

Response

string

Returns URL of the File.

Move a uploaded File into a Directtory

put(string $cat, string $id, \SYSTEM\FILES\ressource $contents) : boolean
static

Arguments

$cat

string

Category for the File

$id

string

ID for the File

$contents

\SYSTEM\FILES\ressource

Uploaded File Ressource

Response

boolean

Returns true or false or throws an Error.

Register a filefolder

registerFolder(string $path, string $cat) : null
static

Arguments

$path

string

Path of the Folder

$cat

string

Category to register that folder to

Response

null

Returns null.

Rename a File

rename(string $cat, string $id, string $newid) : boolean
static

Arguments

$cat

string

Category of the File

$id

string

ID of the File

$newid

string

ID of the renamed File

Response

boolean

Returns true or false or throws an Error.

Properties

array Variable to store all registred file folders

folders : 
static

Type(s)