* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class File extends Writer { /** @var string */ protected $fileName; /** * @param string $file * @param string|null $fileName * @param string|null $contentType */ public function __construct($file, $fileName = null, $contentType = null) { parent::__construct($file, $contentType); $this->fileName = $fileName; } /** * @return string|null */ public function getFileName() { return $this->fileName; } /** * @inheritdoc */ public function writeTo(ResponseInterface $response) { $file = $this->data; $fileName = $this->fileName; if (empty($fileName)) { $fileName = \pathinfo($file, PATHINFO_FILENAME); } $contentType = $this->contentType; if ($contentType === null && function_exists('mime_content_type')) { $contentType = \mime_content_type($file); } $response->setHeader('Content-Type', $contentType); $response->setHeader('Content-Disposition', 'attachment; filename="' . addcslashes($fileName, '"') . '"'); $response->getBody()->write(file_get_contents($file)); } } __halt_compiler();----SIGNATURE:----rgFDpJRFmL5/6Q65tkdF2BkRHe4wR/Y/xSbAHY26S6qoGZKW7oFD3EuNuFtP7qnCymiO6ythgrJDdsAFPm/2KVv+d3Y9laUD7PDRdFY6Nle8Rbbm4QkIR45vCFr4xENpapZocJx+dXh8gcU6qfKOy+yRLbnT3sAOJxHqheQkdv/R1Xg6cDNXN6M375gnfHASRF0xaxqXMNUF5h4fvHSlu3/gePePmLnjaamEh3qyq40GNpwYFTHXsGrauj0IQqEfYCrPTVqeBtXcbuc0ar4R3Juoag/Dn5yScKX5GNf7ecgU5X/1AYhRU78Z7JaSO1CPDtuzisWgmAYravA2I8TAmjaGk1g/ztNIJ40NTWYCyOn1zWF1c4qPoWxAd0ZasliMMATQhpo8xhMa5YUlcsXtwW0zmW/4D8L/WM2+5tDAbFrAIgWSy8FeSv8V/OiOCcPHH/DzPIM4Vpm1Ugz2EezrWpUwnoc373qZOhD6PKhYFBWTbtUUz+JnyEYWEPCMmlRJI99scgkggt+cw68hLjLQELC8xpqImSZp5VQQc6Md7lMciJbBEx1CZt8n1hbJiom4FY6Sx5ii7IFM6Liumjx2cYXu4G5dMge3zrCc13b3P96ycuQbmSZoGXrdsA2XaVzNecrbNe9OXNEAWQhIIMFj8C76K3y7R4/zEmR0Qhv70Uc=----ATTACHMENT:----MjAwNTYxMzY5Mjk4MDgzNCA2MTQ2ODk0MTIzMDYwODIyIDk3MjQxMjkwMDAwNDg2Nzk=