Documentation

FileReader

Interface describing the operations required for reading browsing files (read-only).

Different implementations can fetch files from different locations.

Table of Contents

Methods

downloadFile()  : bool|Stream
Either redirects the user to a location to download the file in $path or directly sends this file to the user. Returns false on failure.
isAllowed()  : bool
Returns whether the given $path is allowed to be accessed.
isDir()  : bool
Returns whether the given $path is valid and is a directory.
listDir()  : array<string|int, FileNode>|null
Return an array of all files and subdirectories in the given directory.

Methods

downloadFile()

Either redirects the user to a location to download the file in $path or directly sends this file to the user. Returns false on failure.

public downloadFile(string $path) : bool|Stream
Parameters
$path : string
Return values
bool|Stream

isAllowed()

Returns whether the given $path is allowed to be accessed.

public isAllowed(string $path) : bool
Parameters
$path : string
Return values
bool

isDir()

Returns whether the given $path is valid and is a directory.

public isDir(string $path) : bool
Parameters
$path : string
Return values
bool

listDir()

Return an array of all files and subdirectories in the given directory.

public listDir(string $path) : array<string|int, FileNode>|null

Returns null when the $path doesn't resolve to a valid directory or the operation fails otherwise.

Parameters
$path : string
Return values
array<string|int, FileNode>|null

        
On this page

Search results