File
A File handling class
since |
1.7.0 |
---|
Methods
append
Append contents to a file
append(string $file, string $buffer, boolean $useStreams = false) : boolean
since |
3.6.0 |
---|
Arguments
- $file
string
The full file path- $buffer
string
The buffer to write- $useStreams
boolean
Use streams
Response
boolean
True on success
copy
Copies a file
copy(string $src, string $dest, string $path = null, boolean $useStreams = false) : boolean
since |
1.7.0 |
---|
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.7.0 |
---|
Arguments
- $file
mixed
The file name or an array of file names
Response
boolean
True on success
exists
Wrapper for the standard file_exists function
exists(string $file) : boolean
since |
1.7.0 |
---|
Arguments
- $file
string
File path
Response
boolean
True if path is a file
getExt
Gets the extension of a file name
getExt(string $file) : string
since |
1.7.0 |
---|
Arguments
- $file
string
The file name
Response
string
The file extension
getName
Returns the name, without any path.
getName(string $file) : string
since |
1.7.0 |
---|---|
deprecated |
4.0 - Use basename() instead. |
Arguments
- $file
string
File path
Response
string
filename
makeSafe
Makes file name safe to use
makeSafe(string $file) : string
since |
1.7.0 |
---|
Arguments
- $file
string
The name of the file [not full path]
Response
string
The sanitised string
move
Moves a file
move(string $src, string $dest, string $path = '', boolean $useStreams = false) : boolean
since |
1.7.0 |
---|
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
read
Read the contents of a file
read(string $filename, boolean $incpath = false, integer $amount, integer $chunksize = 8192, integer $offset) : mixed
since |
1.7.0 |
---|---|
deprecated |
4.0 - Use the native file_get_contents() instead. |
Arguments
- $filename
string
The full file path- $incpath
boolean
Use include path- $amount
integer
Amount of file to read- $chunksize
integer
Size of chunks to read- $offset
integer
Offset of the file
Response
mixed
Returns file contents or boolean False if failed
stripExt
Strips the last extension off of a file name
stripExt(string $file) : string
since |
1.7.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 $allowUnsafe = false, boolean $safeFileOptions = array()) : boolean
since |
1.7.0 |
---|
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- $allowUnsafe
boolean
Allow the upload of unsafe files- $safeFileOptions
boolean
Options to \JFilterInput::isSafeFile
Response
boolean
True on success
write
Write contents to a file
write(string $file, string $buffer, boolean $useStreams = false) : boolean
since |
1.7.0 |
---|
Arguments
- $file
string
The full file path- $buffer
string
The buffer to write- $useStreams
boolean
Use streams
Response
boolean
True on success