src/Controller/MelisCoreGdprController.php
private function downloadXml($fileName, $xml)
    {
        //$response = new HttpResponse();
        $response = $this->getResponse();

        $headers  = $response->getHeaders();
        $headers->addHeaderLine('Content-Type', 'text/xml; charset=utf-8');
        $headers->addHeaderLine('Content-Disposition', "attachment; filename=\"".$fileName."\"");
        $headers->addHeaderLine('Accept-Ranges', 'bytes');
        $headers->addHeaderLine('Content-Length', strlen($xml));
        $headers->addHeaderLine('fileName', $fileName);
        $response->setContent($xml);
        $response->setStatusCode(200);

        return $response;
    }
private function downloadXml($fileName, $xml)
    {
        //$response = new HttpResponse();
        $response = $this->getResponse();

        $headers  = $response->getHeaders();
        $headers->addHeaderLine('Content-Type', 'text/xml; charset=utf-8');
        $headers->addHeaderLine('Content-Disposition', "attachment; filename=\"".$fileName."\"");
        $headers->addHeaderLine('Accept-Ranges', 'bytes');
        $headers->addHeaderLine('Content-Length', strlen($xml));
        $headers->addHeaderLine('fileName', $fileName);
        $response->setContent($xml);
        $response->setStatusCode(200);

        return $response;
    }
private function downloadXml ( $ fileName , $ xml ) { //$response = new HttpResponse(); $ response = $ this -> getResponse ( ) ; $ headers = $ response -> getHeaders ( ) ; $ headers -> addHeaderLine ( 'Content-Type' , 'text/xml; charset=utf-8' ) ; $ headers -> addHeaderLine ( 'Content-Disposition' , "attachment; filename=\"" . $ fileName . "\"" ) ; $ headers -> addHeaderLine ( 'Accept-Ranges' , 'bytes' ) ; $ headers -> addHeaderLine ( 'Content-Length' , strlen ( $ xml ) ) ; $ headers -> addHeaderLine ( 'fileName' , $ fileName ) ; $ response -> setContent ( $ xml ) ; $ response -> setStatusCode ( 200 ) ; return $ response ; }
This will download the xml as a file
@param file name
@param xml
@return HttpResponse
This will download the xml as a file