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/mail/lib/helper/ |
Upload File : |
<?php namespace Bitrix\Mail\Helper; /** * Response with headers that induce browser downloading as file * should be in module main */ class DownloadResponse extends \Bitrix\Main\HttpResponse { /** * Constructor * * @param string $content Content to download * @param string $name Name of downloaded file (should be compliant with standards) * @param string $contentType MIME content type for browser */ public function __construct(string $content, string $name = 'download_file', string $contentType = 'application/octet-stream') { parent::__construct(); $this->setContent($content); $headers = new \Bitrix\Main\Web\HttpHeaders(); $headers->add('Pragma', 'public'); $headers->add('Expires', '0'); $headers->add('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); $headers->add('Content-Disposition', 'attachment; filename="' . $name . '";'); $headers->add('Content-Transfer-Encoding', 'binary'); $headers->add('Content-Length', strlen($content)); $headers->add('Content-Type', $contentType); $this->setHeaders($headers); } }