I've got a problem with a generated file. Here is my action:
<?php
public function exportAction()
{
$this->checkSecurity('EDIT');
$config = $this->getConfiguration();
$resource = $this->findOr404();
$style = $this->render($config->getTemplate('export.css'), array(
'resource' => $resource
));
$response = new Response();
$response->headers->set('Cache-Control', 'private');
$response->headers->set('Content-type', 'plain/text');
$response->headers->set('Content-type', 'application/octet-stream');
$response->headers->set('Content-Disposition', 'attachment; filename="style-' . $resource->getSlug() . '.css";');
$response->sendHeaders();
$response->setContent($style);
return $response;
}
My file is downloaded but in its content there is at the beginning:
HTTP/1.0 200 OK
Cache-Control: no-cache
Date: Tue, 02 Sep 2014 09:16:34 GMT
Does anyone know why ?