Admin_ObjectHelperController::downloadCsvFileAction PHP Метод

downloadCsvFileAction() публичный Метод

    public function downloadCsvFileAction()
    {
        $fileHandle = \Pimcore\File::getValidFilename($this->getParam("fileHandle"));
        $csvFile = $this->getCsvFile($fileHandle);
        if (file_exists($csvFile)) {
            header("Content-Type: application/csv");
            header("Content-Length: " . filesize($csvFile));
            header('Content-Disposition: attachment; filename="export.csv"');
            while (@ob_end_flush()) {
            }
            flush();
            readfile($csvFile);
            unlink($csvFile);
        } else {
            exit;
        }
    }