MediaWiki master
MediaWiki\Output\StreamFile Class Reference

Functions related to the output of file content. More...

Static Public Member Functions

static contentTypeFromPath ( $filename, $safe=true)
 Determine the file type of a file based on the path.
 
static setHeader ( $header)
 
static stream ( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
 Stream a file to the browser, adding all the headings and fun stuff.
 

Detailed Description

Functions related to the output of file content.

Definition at line 37 of file StreamFile.php.

Member Function Documentation

◆ contentTypeFromPath()

static MediaWiki\Output\StreamFile::contentTypeFromPath ( $filename,
$safe = true )
static

◆ setHeader()

static MediaWiki\Output\StreamFile::setHeader ( $header)
static
Parameters
string$header
Access: internal

Definition at line 81 of file StreamFile.php.

References $header.

◆ stream()

static MediaWiki\Output\StreamFile::stream ( $fname,
$headers = [],
$sendErrors = true,
$optHeaders = [],
$flags = 0 )
static

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
string$fnameFull name and path of the file to stream
array$headersAny additional headers to send if the file exists
bool$sendErrorsSend error messages if errors occur (like 404)
array$optHeadersHTTP request header map (e.g. "range") (use lowercase keys)
int$flagsBitfield of STREAM_* constants
Returns
bool Success

Definition at line 53 of file StreamFile.php.

References FileBackend\isStoragePath().


The documentation for this class was generated from the following file: