Код: Выделить всё
$response = new Response();
$response->headers->set('Content-Type', "text/csv");
$response->headers->set('Content-Disposition', 'attachment; filename="'.$fileName.'"');
$response->headers->set('Pragma', "no-cache");
$response->headers->set('Expires', "0");
$response->headers->set('Content-Transfer-Encoding', "binary");
$response->headers->set('Content-Length', filesize($fileName));
$response->prepare();
$response->sendHeaders();
$response->setContent(readfile($fileName));
$response->sendContent();
Код: Выделить всё
$fileNameОбнаруженная проблема заключается в следующем. что на некоторых страницах я получаю файл info.csv, а на других получаю только сообщение:
Код: Выделить всё
No webpage was found for the web address: http://mywebpage.com/downloadКод: Выделить всё
Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.Журнал ошибок Apache ничего об этом не показывает.
Кто-нибудь раньше принудительно загружал файл .csv в Symfony 2? Если да, то что я делаю не так?
Подробнее здесь: https://stackoverflow.com/questions/103 ... nse-object
Мобильная версия