\Nano4\UtilsFile

File class. Offers a bunch of wrappers to common file operations including managing uploaded files.

Summary

Methods
Properties
Constants
__construct()
hasUpload()
getUpload()
getUploadQQ()
saveTo()
saveAs()
copyTo()
rename()
update_size()
getString()
putString()
getDelimited()
getArray()
putArray()
getHandle()
getReader()
getWriter()
getLogger()
getContents()
putContents()
getZip()
getZipDir()
filesize_str()
fileSize()
stats()
modifiedTime()
rmtree()
$name
$type
$size
$file
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : 

Type

$type

$type : 

Type

$size

$size : 

Type

$file

$file : 

Type

Methods

__construct()

__construct(  $file = Null) 

Build a new File object.

Parameters

$file

hasUpload()

hasUpload(  $name) 

See if a standard HTTP upload of a set name exists.

Parameters

$name

getUpload()

getUpload(  $name) 

Create a File object from a standard HTTP upload.

Parameters

$name

getUploadQQ()

getUploadQQ(  $name = 'qqfile') 

Create a File object from a Fine Uploader (qq.FileUploader) request.

Parameters

$name

saveTo()

saveTo(  $folder,   $move = false,   $update = true) 

Parameters

$folder
$move
$update

saveAs()

saveAs(  $target,   $move = true,   $update = true) 

Parameters

$target
$move
$update

copyTo()

copyTo(  $target) 

Parameters

$target

rename()

rename(  $newname) 

Parameters

$newname

update_size()

update_size() 

getString()

getString(  $forceUTF8 = false) 

Parameters

$forceUTF8

putString()

putString(  $data,   $opts = array()) 

Parameters

$data
$opts

getDelimited()

getDelimited(  $opts = array()) 

Parse a Delimiter Seperated Values file (defaults to Tab.)

See CSV::parse() for a list of valid options.

Parameters

$opts

getArray()

getArray() 

putArray()

putArray(  $data,   $opts = array()) 

Parameters

$data
$opts

getHandle()

getHandle(  $mode = 'rb',   $addBin = null) 

Parameters

$mode
$addBin

getReader()

getReader(  $bin = true) 

Parameters

$bin

getWriter()

getWriter(  $bin = true) 

Parameters

$bin

getLogger()

getLogger(  $bin = true) 

Parameters

$bin

getContents()

getContents(  $bin = true) 

Parameters

$bin

putContents()

putContents(  $data,   $bin = true) 

Parameters

$data
$bin

getZip()

getZip() 

getZipDir()

getZipDir(  $prefix = 'zipfile_') 

Parameters

$prefix

filesize_str()

filesize_str(\Nano4\Utils\number  $size) : string

Convert a size in bytes to a friendly string.

Parameters

\Nano4\Utils\number $size

The size in bytes you want to convert.

Returns

string —

The friendly size (e.g. "4.4 MB")

fileSize()

fileSize() : string

Returns the friendly string representing our own file size.

Uses filesize_str() to generate the string.

Returns

string —

The friendly size.

stats()

stats() 

Returns the file stats.

modifiedTime()

modifiedTime(string  $format = Null) : mixed

Return the time when the file was last modified.

Parameters

string $format

Optional, a valid DateTime Format.

Returns

mixed —

A DateTime object, or a string, depending on if you passed the $format option.

rmtree()

rmtree(  $path) 

Recursively remove an entire directory tree.

Parameters

$path