Obsah .txt souboru jako text/plain

MartinVolenec
Člen | 36
+
0
-

Dobrý den,

snažím se obsah jednoho .txt souboru odeslat jako text/plain. Soubor „nestahovat“, nýbrž pouze zobrazit obsah.
Zatím mám následující:

<?php

public function actionDefault()
{
    $this->sendResponse(new FileResponse(cesta k souboru, null, 'text/plain'));
}

?>

Nicméně to stále vrací celý soubor (stahuje).

Nápady na vyřešení?
Děkuji

Rick Strafy
Nette Blogger | 63
+
0
-
new StringResponse(file_get_contents($path), 'fileName.txt')
MartinVolenec
Člen | 36
+
0
-
<?php

new TextResponse(file_get_contents($path));

?>

Vůbec mě to nenapadlo. Děkuji.

Rick Strafy
Nette Blogger | 63
+
0
-

Neni zac, ta TextResponse vrati text/html, to zmenit asi nejde, preto ta StringResponse.