Я хочу, чтобы вывод был таким: «cp_qrcode.eps». Вот что я сделал:
Код: Выделить всё
public function downloadQrCode()
{
$filePath = __DIR__ . '/../../../../../../var/temp/cp_qrcode.eps';
if (!file_exists($filePath)) {
header('HTTP/1.1 404 Not Found');
exit;
}
if (ob_get_level()) {
ob_flush();
flush();
}
header('Content-Type: application/postscript');
header('Content-Disposition: attachment; filename="cp_qrcode.eps"');
header('Content-Length: ' . filesize($filePath));
return readfile($filePath);
}
[img]https://i.sstatic. net/V0q3uCgt.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/786 ... isposition