Functions related to the output of file content.
More...
|
static | parseRange ( $range, $size) |
| Convert a Range header value to an absolute (start, end) range tuple.
|
|
static | send404Message ( $fname, $flags=0) |
| Send out a standard 404 message for a file.
|
|
Functions related to the output of file content.
- Since
- 1.28
Definition at line 28 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 47 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 251 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 |
integer | $size | File size |
- Returns
- array|string Returns error string on failure (start, end, length)
- Since
- 1.24
Definition at line 208 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) |
integer | $flags | Bitfield of STREAM_* constants |
- Exceptions
-
- Returns
- bool Success
Definition at line 69 of file HTTPFileStreamer.php.
References $flags, $header, $type, as, false, HttpStatus\header(), parseRange(), print, send404Message(), STREAM_HEADLESS, TS_RFC2822, and TS_UNIX.
◆ $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: