File

A File handling class

since

1.0

Methods

copy

Copies a file

copy(string $src, string $dest, string $path = null, boolean $useStreams = false) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

\UnexpectedValueException

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

booleanTrue to use streams

Response

booleanTrue on success

delete

Delete a file or array of files

delete(mixed $file) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

Arguments

$file

mixedThe file name or an array of file names

Response

booleanTrue on success

makeSafe

Makes the file name safe to use

makeSafe(string $file, array $stripChars = array('#^\.#')) : string
static
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 = '', boolean $useStreams = false) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

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

booleanTrue to use streams

Response

booleanTrue on success

stripExt

Strips the last extension off of a file name

stripExt(string $file) : string
static
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, boolean $useStreams = false) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

Arguments

$src

stringThe name of the php (temporary) uploaded file

$dest

stringThe path (including filename) to move the uploaded file to

$useStreams

booleanTrue to use streams

Response

booleanTrue on success

write

Write contents to a file

write(string $file, string &$buffer, boolean $useStreams = false) : boolean
static
since

1.0

Arguments

$file

stringThe full file path

$buffer

stringThe buffer to write

$useStreams

booleanUse streams

Response

booleanTrue on success