File
A File handling class
since |
1.0 |
---|---|
package |
Joomla Framework |
Methods
copy
Copies a file
copy(string src, string dest, string path = null, bool useStreams = false) : bool
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
bool
True to use streams
Response
bool
True on success
delete
Delete a file or array of files
delete(mixed file) : bool
since |
1.0 |
---|---|
throws |
|
Arguments
- file
mixed
The file name or an array of file names
Response
bool
True on success
invalidateFileCache
Invalidate any opcache for a newly written file immediately, if opcache* functions exist and if this was a PHP file.
invalidateFileCache(string file) : void
Arguments
- file
string
The path to the file just written to, to flush from opcache
makeSafe
Makes the file name safe to use
makeSafe(string file, array stripChars = ['#^\.#']) : 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 = '', bool useStreams = false) : bool
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
bool
True to use streams
Response
bool
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, bool useStreams = false) : bool
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
bool
True to use streams
Response
bool
True on success
write
Write contents to a file
write(string file, string &buffer, bool useStreams = false, bool appendToFile = false) : bool
since |
1.0 |
---|
Arguments
- file
string
The full file path- buffer
string
The buffer to write- useStreams
bool
Use streams- appendToFile
bool
Append to the file and not overwrite it.
Response
bool
True on success