Common FILE routines

version 1
package wikindx4\core\file
author Mark Grimshaw

 Methods

FILE

__construct() 

create a fileName for this file.

createFileName(string $dirName, string $string, string $extension) : array

If directory based on session ID does not exist, create it.

Parameters

$dirName

string

$string

string

File contents

$extension

string

File extension

Returns

array(filename, full filepath)

Get file max upload size

fileMaxSize() : int

Returns

int

Store uploaded file in given directory with given name

fileStore(string $dirName, string $name) : boolean

Parameters

$dirName

string

$name

string

Returns

boolean

Return filename, hash, type and size of an uploaded file

fileUpload(string $filename) : array

Parameters

$filename

string

Returns

array(filename, hash, type, size)

list and HTML format all files for sessionID

listFiles() : array

Returns

array(filesDir, fileDeleteSecs, fileArray)

Download file to user

readfile_chunked(string $file) 

From http://uk3.php.net/function.readfile

Parameters

$file

string

Set download headers

setHeaders(string $type, int $size, string $filename) 

Parameters

$type

string

$size

int

$filename

string

tidy up the files directory by removing all files and folders older than 'configFileDeleteSeconds'

tidyFiles() 

Convert some ini values to numerical values

return_bytes(string $val) : int

Parameters

$val

string

Returns

int

 Properties

 

$config 
 

$db 
 

$filesDir 
 

$session