PHP Class Symfony\Component\HttpFoundation\BinaryFileResponse

Author: Niklas Fiekas ([email protected])
Author: stealth35 ([email protected])
Author: Igor Wiedler ([email protected])
Author: Jordan Alliot ([email protected])
Author: Sergey Linnik ([email protected])
Inheritance: extends Response
Afficher le fichier Open project: symfony/http-foundation Class Usage Examples

Protected Properties

Свойство Type Description
$deleteFileAfterSend
$file Symfony\Component\HttpFoundation\File\File
$maxlen
$offset
$trustXSendfileTypeHeader

Méthodes publiques

Méthode Description
__construct ( SplFileInfo | string $file, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) Constructor.
create ( SplFileInfo | string $file = null, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
deleteFileAfterSend ( boolean $shouldDelete ) : BinaryFileResponse If this is set to true, the file will be unlinked after the request is send Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
getContent ( ) : false
getFile ( ) : File Gets the file.
prepare ( Request $request )
sendContent ( ) Sends the file.
setAutoEtag ( ) Automatically sets the ETag header according to the checksum of the file.
setAutoLastModified ( ) Automatically sets the Last-Modified header according the file modification date.
setContent ( $content )
setContentDisposition ( string $disposition, string $filename = '', string $filenameFallback = '' ) : BinaryFileResponse Sets the Content-Disposition header with the given filename.
setFile ( SplFileInfo | string $file, string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse Sets the file to stream.
trustXSendfileTypeHeader ( ) Trust X-Sendfile-Type header.

Private Methods

Méthode Description
hasValidIfRangeHeader ( $header )

Method Details

__construct() public méthode

Constructor.
public __construct ( SplFileInfo | string $file, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true )
$file SplFileInfo | string The file to stream
$status integer The response status code
$headers array An array of response headers
$public boolean Files are public by default
$contentDisposition null | string The type of Content-Disposition to set automatically with the filename
$autoEtag boolean Whether the ETag header should be automatically set
$autoLastModified boolean Whether the Last-Modified header should be automatically set

create() public static méthode

public static create ( SplFileInfo | string $file = null, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
$file SplFileInfo | string The file to stream
$status integer The response status code
$headers array An array of response headers
$public boolean Files are public by default
$contentDisposition null | string The type of Content-Disposition to set automatically with the filename
$autoEtag boolean Whether the ETag header should be automatically set
$autoLastModified boolean Whether the Last-Modified header should be automatically set
Résultat BinaryFileResponse The created response

deleteFileAfterSend() public méthode

If this is set to true, the file will be unlinked after the request is send Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
public deleteFileAfterSend ( boolean $shouldDelete ) : BinaryFileResponse
$shouldDelete boolean
Résultat BinaryFileResponse

getContent() public méthode

public getContent ( ) : false
Résultat false

getFile() public méthode

Gets the file.
public getFile ( ) : File
Résultat Symfony\Component\HttpFoundation\File\File The file to stream

prepare() public méthode

public prepare ( Request $request )
$request Request

sendContent() public méthode

public sendContent ( )

setAutoEtag() public méthode

Automatically sets the ETag header according to the checksum of the file.
public setAutoEtag ( )

setAutoLastModified() public méthode

Automatically sets the Last-Modified header according the file modification date.
public setAutoLastModified ( )

setContent() public méthode

public setContent ( $content )

setContentDisposition() public méthode

Sets the Content-Disposition header with the given filename.
public setContentDisposition ( string $disposition, string $filename = '', string $filenameFallback = '' ) : BinaryFileResponse
$disposition string ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT
$filename string Optionally use this filename instead of the real name of the file
$filenameFallback string A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename
Résultat BinaryFileResponse

setFile() public méthode

Sets the file to stream.
public setFile ( SplFileInfo | string $file, string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) : BinaryFileResponse
$file SplFileInfo | string The file to stream
$contentDisposition string
$autoEtag boolean
$autoLastModified boolean
Résultat BinaryFileResponse

trustXSendfileTypeHeader() public static méthode

Trust X-Sendfile-Type header.
public static trustXSendfileTypeHeader ( )

Property Details

$deleteFileAfterSend protected_oe property

protected $deleteFileAfterSend

$file protected_oe property

protected File,Symfony\Component\HttpFoundation\File $file
Résultat Symfony\Component\HttpFoundation\File\File

$maxlen protected_oe property

protected $maxlen

$offset protected_oe property

protected $offset

$trustXSendfileTypeHeader protected_oe static_oe property

protected static $trustXSendfileTypeHeader