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
Exibir arquivo Open project: symfony/http-foundation Class Usage Examples

Protected Properties

Property Type Description
$deleteFileAfterSend
$file Symfony\Component\HttpFoundation\File\File
$maxlen
$offset
$trustXSendfileTypeHeader

Public Methods

Method 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

Method Description
hasValidIfRangeHeader ( $header )

Method Details

__construct() public method

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 method

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
return BinaryFileResponse The created response

deleteFileAfterSend() public method

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
return BinaryFileResponse

getContent() public method

public getContent ( ) : false
return false

getFile() public method

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

prepare() public method

public prepare ( Request $request )
$request Request

sendContent() public method

public sendContent ( )

setAutoEtag() public method

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

setAutoLastModified() public method

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

setContent() public method

public setContent ( $content )

setContentDisposition() public method

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
return BinaryFileResponse

setFile() public method

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
return BinaryFileResponse

trustXSendfileTypeHeader() public static method

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
return 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