Aplus Framework Docs

ResponseDownload

Trait ResponseDownload.

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

Table of Contents

$request  : Request
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
Return values
bool

setDownload()

Sets a file to download/stream.

public setDownload(string $filepath[, bool $inline = false ][, bool $acceptRanges = true ], int $delay[, 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

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

throws
RuntimeException

If can not get the file size or modification time

Return values
static

Search results