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
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- $use_streams
boolean
True to use streams
Response
boolean
True on success
delete
Delete a file or array of files
delete(mixed $file) : boolean
since |
11.1 |
---|
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 |
11.1 |
---|
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 |
11.1 |
---|
Arguments
- $file
string
The file name
Response
string
The file extension
getName
Returns the name, without any path.
getName(string $file) : string
since |
11.1 |
---|
Arguments
- $file
string
File path
Response
string
filename
makeSafe
Makes file name safe to use
makeSafe(string $file) : string
since |
11.1 |
---|
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 $use_streams = false) : boolean
since |
11.1 |
---|
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- $use_streams
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 |
11.1 |
---|
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 |
11.1 |
---|
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 $use_streams = false) : boolean
since |
11.1 |
---|
Arguments
- $src
string
The name of the php (temporary) uploaded file- $dest
string
The path (including filename) to move the uploaded file to- $use_streams
boolean
True to use streams
Response
boolean
True on success
write
Write contents to a file
write(string $file, &$buffer, boolean $use_streams = false) : boolean
since |
11.1 |
---|
Arguments
- $file
string
The full file path- $buffer
- $use_streams
boolean
Use streams
Response
boolean
True on success