File
A File handling class
since |
1.0 |
---|
Methods
copy
Copies a file
copy(string $src, string $dest, string $path = null, boolean $useStreams = false) : boolean
since |
1.0 |
---|---|
throws |
|
Arguments
- $src
string
The path to the source file- $dest
string
The path to the destination file- $path
string
An optional base path to prefix to the file names- $useStreams
boolean
True to use streams
Response
boolean
True on success
delete
Delete a file or array of files
delete(mixed $file) : boolean
since |
1.0 |
---|---|
throws |
|
Arguments
- $file
mixed
The file name or an array of file names
Response
boolean
True on success
makeSafe
Makes the file name safe to use
makeSafe(string $file, array $stripChars = array('#^\.#')) : string
since |
1.0 |
---|
Arguments
- $file
string
The name of the file [not full path]- $stripChars
array
Array of regex (by default will remove any leading periods)
Response
string
The sanitised string
move
Moves a file
move(string $src, string $dest, string $path = '', boolean $useStreams = false) : boolean
since |
1.0 |
---|---|
throws |
|
Arguments
- $src
string
The path to the source file- $dest
string
The path to the destination file- $path
string
An optional base path to prefix to the file names- $useStreams
boolean
True to use streams
Response
boolean
True on success
stripExt
Strips the last extension off of a file name
stripExt(string $file) : string
since |
1.0 |
---|
Arguments
- $file
string
The file name
Response
string
The file name without the extension
upload
Moves an uploaded file to a destination folder
upload(string $src, string $dest, boolean $useStreams = false) : boolean
since |
1.0 |
---|---|
throws |
|
Arguments
- $src
string
The name of the php (temporary) uploaded file- $dest
string
The path (including filename) to move the uploaded file to- $useStreams
boolean
True to use streams
Response
boolean
True on success
write
Write contents to a file
write(string $file, string &$buffer, boolean $useStreams = false, boolean $appendToFile = false) : boolean
since |
1.0 |
---|
Arguments
- $file
string
The full file path- $buffer
string
The buffer to write- $useStreams
boolean
Use streams- $appendToFile
boolean
Append to the file and not overwrite it.
Response
boolean
True on success