-1

I have a question :

        $sFileName = 'filen_name.csv';
        header('Content-Encoding: UTF-8');
        header("Content-Type:application/csv;charset=UTF-8");
        header('Content-Disposition: attachement; filename="' . $sFileName . '";');
        header("Pragma: no-cache");
        header("Expires: 0");
        echo "\xEF\xBB\xBF";
        $output = fopen('php://output', 'w');
        fputcsv($output, array('First','Second'), ";");
        foreach ($aExport as $value) {
            fputcsv($output, $value, ";");
        }
        fpassthru($output);
        fclose($output);
        exit;
        return $this->redirect('route_name');

I want to redirect user after generation of .csv. Can you help me please ? Thx in advance and sorry for my english

Harea Costicla
  • 797
  • 3
  • 9
  • 20
  • 1
    One request should generate only one response, and downloading the csv is that response, redirection would be a second response, one too many – Mark Baker Mar 11 '16 at 09:33

1 Answers1

0

if you just need to generate, without downloading then the heade are wrong, and quietly potresto only add the header to redirect