Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/engine/response/ |
Upload File : |
<?php namespace Bitrix\Main\Engine\Response; use Bitrix\Main; class BFile extends File { protected $file; public function __construct(array $file, $name = null) { $this->file = $file; if ($name === null) { $name = $this->file['ORIGINAL_NAME']; } parent::__construct(null, $name, $this->file['CONTENT_TYPE']); } public static function createByFileData(array $file, $name = null) { return new self($file, $name); } public static function createByFileId($fileId, $name = null) { $file = \CFile::getFileArray($fileId); if (!$file) { throw new Main\ObjectNotFoundException("Could not find file ({$fileId})"); } return new self($file, $name); } /** * @return array */ public function getFile() { return $this->file; } /** * @return array|bool|null */ protected function prepareFile() { return $this->getFile(); } protected function prepareOptions() { return [ 'force_download' => !$this->isShowInline(), 'cache_time' => $this->getCacheTime(), 'attachment_name' => $this->getName(), 'content_type' => $this->getContentType(), ]; } }