Functions related to the output of file content.
More...
Functions related to the output of file content.
- Since
- 1.28
Definition at line 29 of file HTTPFileStreamer.php.
◆ __construct()
HTTPFileStreamer::__construct |
( |
|
$path, |
|
|
array |
$params = [] |
|
) |
| |
- Parameters
-
string | $path | Local filesystem path to a file |
array | $params | Options map, which includes:
- obResetFunc : alternative callback to clear the output buffer
- streamMimeFunc : alternative method to determine the content type from the path
|
Definition at line 48 of file HTTPFileStreamer.php.
References $params, and $path.
◆ contentTypeFromPath()
static HTTPFileStreamer::contentTypeFromPath |
( |
|
$filename | ) |
|
|
staticprotected |
Determine the file type of a file based on the path.
- Parameters
-
string | $filename | Storage path or file system path |
- Returns
- null|string
Definition at line 252 of file HTTPFileStreamer.php.
References $ext.
◆ parseRange()
static HTTPFileStreamer::parseRange |
( |
|
$range, |
|
|
|
$size |
|
) |
| |
|
static |
Convert a Range header value to an absolute (start, end) range tuple.
- Parameters
-
string | $range | Range header value |
int | $size | File size |
- Returns
- array|string Returns error string on failure (start, end, length)
- Since
- 1.24
Definition at line 209 of file HTTPFileStreamer.php.
References list.
Referenced by StreamFile\parseRange(), and stream().
◆ resetOutputBuffers()
static HTTPFileStreamer::resetOutputBuffers |
( |
| ) |
|
|
staticprotected |
◆ send404Message()
static HTTPFileStreamer::send404Message |
( |
|
$fname, |
|
|
|
$flags = 0 |
|
) |
| |
|
static |
◆ stream()
HTTPFileStreamer::stream |
( |
|
$headers = [] , |
|
|
|
$sendErrors = true , |
|
|
|
$optHeaders = [] , |
|
|
|
$flags = 0 |
|
) |
| |
Stream a file to the browser, adding all the headings and fun stuff.
Headers sent include: Content-type, Content-Length, Last-Modified, and Content-Disposition.
- Parameters
-
array | $headers | Any additional headers to send if the file exists |
bool | $sendErrors | Send error messages if errors occur (like 404) |
array | $optHeaders | HTTP request header map (e.g. "range") (use lowercase keys) |
int | $flags | Bitfield of STREAM_* constants |
- Exceptions
-
- Returns
- bool Success
Definition at line 70 of file HTTPFileStreamer.php.
References $flags, $header, $type, as, false, HttpStatus\header(), parseRange(), send404Message(), and STREAM_HEADLESS.
◆ $obResetFunc
callable HTTPFileStreamer::$obResetFunc |
|
protected |
◆ $path
string HTTPFileStreamer::$path |
|
protected |
◆ $streamMimeFunc
callable HTTPFileStreamer::$streamMimeFunc |
|
protected |
◆ STREAM_ALLOW_OB
const HTTPFileStreamer::STREAM_ALLOW_OB = 2 |
◆ STREAM_HEADLESS
const HTTPFileStreamer::STREAM_HEADLESS = 1 |
The documentation for this class was generated from the following file: