JFile
A File handling class
| package |
Joomla.Platform |
|---|---|
| subpackage |
FileSystem |
| since |
11.1 |
Methods
copy
Copies a file
copy(string $src, string $dest, string $path = null, boolean $use_streams = false) : boolean
| since |
11.1 |
|---|
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- $use_streams
booleanTrue to use streams
Response
booleanTrue on success
delete
Delete a file or array of files
delete(mixed $file) : boolean
| since |
11.1 |
|---|
Arguments
- $file
mixedThe file name or an array of file names
Response
booleanTrue on success
exists
Wrapper for the standard file_exists function
exists(string $file) : boolean
| since |
11.1 |
|---|
Arguments
- $file
stringFile path
Response
booleanTrue if path is a file
getExt
Gets the extension of a file name
getExt(string $file) : string
| since |
11.1 |
|---|
Arguments
- $file
stringThe file name
Response
stringThe file extension
getName
Returns the name, without any path.
getName(string $file) : string
| since |
11.1 |
|---|
Arguments
- $file
stringFile path
Response
stringfilename
makeSafe
Makes file name safe to use
makeSafe(string $file) : string
| since |
11.1 |
|---|
Arguments
- $file
stringThe name of the file [not full path]
Response
stringThe sanitised string
move
Moves a file
move(string $src, string $dest, string $path = '', boolean $use_streams = false) : boolean
| since |
11.1 |
|---|
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- $use_streams
booleanTrue to use streams
Response
booleanTrue on success
read
Read the contents of a file
read(string $filename, boolean $incpath = false, integer $amount, integer $chunksize = 8192, integer $offset) : mixed
| since |
11.1 |
|---|
Arguments
- $filename
stringThe full file path- $incpath
booleanUse include path- $amount
integerAmount of file to read- $chunksize
integerSize of chunks to read- $offset
integerOffset of the file
Response
mixedReturns file contents or boolean False if failed
stripExt
Strips the last extension off of a file name
stripExt(string $file) : string
| since |
11.1 |
|---|
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, boolean $use_streams = false) : boolean
| since |
11.1 |
|---|
Arguments
- $src
stringThe name of the php (temporary) uploaded file- $dest
stringThe path (including filename) to move the uploaded file to- $use_streams
booleanTrue to use streams
Response
booleanTrue on success
write
Write contents to a file
write(string $file, &$buffer, boolean $use_streams = false) : boolean
| since |
11.1 |
|---|
Arguments
- $file
stringThe full file path- $buffer
- $use_streams
booleanUse streams
Response
booleanTrue on success