From fbc156e16bea9cf50065d9c362d56d7e68ab3705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 25 Sep 2018 17:06:55 +0200 Subject: [PATCH] Force download of eported data, generate individual filenames --- .../Classes/Controller/ResellerController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php b/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php index cafd00a8..309e021e 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/ResellerController.php @@ -99,6 +99,15 @@ class ResellerController extends ActionController $serializer = new Serializer($normalizers, $encoders); + $filename = 'export_' . $reseller->getCode() . '_' . date('Y-m-d') . '.xml'; + + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Content-Description: File Transfer'); + header('Content-type: text/xml'); + header('Content-Disposition: attachment; filename=' . $filename); + header('Expires: 0'); + header('Pragma: public'); + echo $serializer->serialize($data, 'xml', [ 'xml_encoding' => 'utf-8', 'xml_format_output' => true ]); return false; @@ -112,10 +121,12 @@ class ResellerController extends ActionController { $data = $this->resellerService->preprocessAll($reseller, [ 'width' => '1200', 'maxHeight' => '630', 'cropVariant' => 'facebook' ]); + $filename = 'export_' . $reseller->getCode() . '_' . date('Y-m-d') . '.csv'; + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Description: File Transfer'); header('Content-type: text/csv'); - header('Content-Disposition: attachment; filename=export.csv'); + header('Content-Disposition: attachment; filename=' . $filename); header('Expires: 0'); header('Pragma: public');