Aplus Framework Docs

ResponseDownload

Trait ResponseDownload.

Tags
see
https://datatracker.ietf.org/doc/html/rfc7233

Table of Contents

Properties

$request  : Request

Methods

hasDownload()  : bool
Tell if Response has a downloadable file.
setDownload()  : static
Sets a file to download/stream.
sendDownload()  : void

Properties

Methods

hasDownload()

Tell if Response has a downloadable file.

public hasDownload() : bool
Attributes
#[Pure]
Return values
bool

setDownload()

Sets a file to download/stream.

public setDownload(string $filepath[, bool $inline = false ][, bool $acceptRanges = true ][, int $delay = 0 ][, int $readLength = 1024 ][, string|null $filename = null ]) : static
Parameters
$filepath : string
$inline : bool = false

Set Content-Disposition header as "inline". Browsers load the file in the window. Set true to allow video or audio streams

$acceptRanges : bool = true

Set Accept-Ranges header to "bytes". Allow partial downloads, media players to move the time position forward and back and download managers to continue/download multi-parts

$delay : int = 0

Delay between flushs in microseconds

$readLength : int = 1024

Bytes read by flush

$filename : string|null = null

A custom filename

Tags
throws
InvalidArgumentException

If invalid file path

RuntimeException

If can not get the file size or modification time

Return values
static

        
On this page

Search results