class JFile


Located at : UKNOWVA_ROOT/libraries/joomla/filesystem/file.php

A File handling class

Methods

static string
getExt(string $file)

Gets the extension of a file name

static string
stripExt(string $file)

Strips the last extension off of a file name

static string
makeSafe(string $file)

Makes file name safe to use

static boolean
copy($src, $dest, $path = null, $use_streams = false)

Copies a file

static boolean
delete(mixed $file)

Delete a file or array of files

static boolean
move($src, $dest, $path = '', $use_streams = false)

Moves a file

static mixed
read(string $filename, boolean $incpath = false, integer $amount, integer $chunksize = 8192, integer $offset)

Read the contents of a file

static boolean
write($file, $buffer, $use_streams = false)

Write contents to a file

static boolean
upload($src, $dest, $use_streams = false)

Moves an uploaded file to a destination folder

static boolean
exists(string $file)

Wrapper for the standard file_exists function

static string
getName(string $file)

Returns the name, without any path.

Details

at line 31
static string getExt(string $file)

Gets the extension of a file name

Parameters

string $file The file name

Return Value

string The file extension

at line 46
static string stripExt(string $file)

Strips the last extension off of a file name

Parameters

string $file The file name

Return Value

string The file name without the extension

at line 59
static string makeSafe(string $file)

Makes file name safe to use

Parameters

string $file The name of the file [not full path]

Return Value

string The sanitised string

at line 76
static boolean copy($src, $dest, $path = null, $use_streams = false)

Copies a file

Parameters

$src
$dest
$path
$use_streams

Return Value

boolean True on success

at line 146
static boolean delete(mixed $file)

Delete a file or array of files

Parameters

mixed $file The file name or an array of file names

Return Value

boolean True on success

at line 205
static boolean move($src, $dest, $path = '', $use_streams = false)

Moves a file

Parameters

$src
$dest
$path
$use_streams

Return Value

boolean True on success

at line 272
static mixed read(string $filename, boolean $incpath = false, integer $amount, integer $chunksize = 8192, integer $offset)

Read the contents of a file

Parameters

string $filename The full file path
boolean $incpath Use include path
integer $amount Amount of file to read
integer $chunksize Size of chunks to read
integer $offset Offset of the file

Return Value

mixed Returns file contents or boolean False if failed

at line 324
static boolean write($file, $buffer, $use_streams = false)

Write contents to a file

Parameters

$file
$buffer
$use_streams

Return Value

boolean True on success

at line 376
static boolean upload($src, $dest, $use_streams = false)

Moves an uploaded file to a destination folder

Parameters

$src
$dest
$use_streams

Return Value

boolean True on success

at line 443
static boolean exists(string $file)

Wrapper for the standard file_exists function

Parameters

string $file File path

Return Value

boolean True if path is a file

at line 456
static string getName(string $file)

Returns the name, without any path.

Parameters

string $file File path

Return Value

string filename