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
stringThe path to the source file- dest
stringThe path to the destination file- path
stringAn optional base path to prefix to the file names- useStreams
boolTrue to use streams
Response
boolTrue on success
delete
Delete a file or array of files
delete(mixed file) : bool
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- file
mixedThe file name or an array of file names
Response
boolTrue on success
makeSafe
Makes the file name safe to use
makeSafe(string file, array stripChars = array('#^\.#')) : string
| since |
1.0 |
|---|
Arguments
- file
stringThe name of the file [not full path]- stripChars
arrayArray of regex (by default will remove any leading periods)
Response
stringThe sanitised string
move
Moves a file
move(string src, string dest, string path = '', bool useStreams = false) : bool
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- src
stringThe path to the source file- dest
stringThe path to the destination file- path
stringAn optional base path to prefix to the file names- useStreams
boolTrue to use streams
Response
boolTrue on success
stripExt
Strips the last extension off of a file name
stripExt(string file) : string
| since |
1.0 |
|---|
Arguments
- file
stringThe file name
Response
stringThe 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
stringThe name of the php (temporary) uploaded file- dest
stringThe path (including filename) to move the uploaded file to- useStreams
boolTrue to use streams
Response
boolTrue 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
stringThe full file path- buffer
stringThe buffer to write- useStreams
boolUse streams- appendToFile
boolAppend to the file and not overwrite it.
Response
boolTrue on success