Documentation

BFile

\Bitrix\Main\Engine\Response\BFile - methods for handling files. You can sufficiently use \Bitrix\Main\Engine\Response\BFile when you need to pass file, stored in b_file for download.

Methods

Method Description Available from version
__construct(
   array $file,
   $name = null)
Constructs BFile object, by using previously generated $file. Parameters:
  • $file {array} - array, describing the file, see. \CFile::getFileArray().
  • $name {string} - name for the download file.
createByFileData(
   array $file,
   $name = null
)
Creates BFile object, by using previously generated $file. Parameters
  • $file {array} - array, describing file, see \CFile::getFileArray().
  • $name {string} - name for the download file.
createByFileId(
   $fileId,
   $name = null
)
Creates BFile object, by using $fileId. The $fileId value is used for searching records in the table b_file by ID. Parameters:
  • $fileId {int} - file ID from b_file table.
  • $name {string} - name for the download file.
createByFileId(
   $fileId,
   $name = null
)
Creates BFile object, by using $fileId. The $fileId value is used for searching record in the b_file table by ID. Parameters:
  • $fileId {int} - file ID from b_file table.
  • $name {string} - name for the download file.
getPath(
)
Getting absolute path to file.
setPath(
   $path
)
Setting absolute path to file. Parameters:
  • $path {string} - Absolute path to file.
getName(
)
Getting file name.
setName(
   $name
)
Getting file name. Parameters:
  • $name {string} - file name.
getContentType(
)
Getting this file content-type. By default, sourced from table b_file.
setContentType(
   $contentType
)
Sets this file content-type. Parameters:
  • $contentType {string} - content-type файла.
showInline(
   $enabled
)
Parameters:
  • $enabled {bool} When true, sets header Content-Disposition: inline, otherwise Content-Disposition: attachment.
setCacheTime(
   $cacheTime
)
Sets caching time. Parameters:
  • $cacheTime {int} File caching time by browser in seconds.
getCacheTime(
)
Returns set file caching time.

© «Bitrix24», 2001-2024
Up