StreamingController.php 738 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\ResponseHeaderBag;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class StreamingController extends AbstractController {
  7. /**
  8. * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
  9. *
  10. * @Route(
  11. * name = "pass",
  12. * path = "/pass"
  13. * )
  14. */
  15. public function pass() {
  16. $response = $this->file('/etc/passwd', 'blougou', ResponseHeaderBag::DISPOSITION_INLINE);
  17. // Defaults to 'attachment; filename="${basename($file)}"'. When not using
  18. // the 2nd and 3rd arguments:
  19. // $response->headers->set('Content-disposition', 'inline');
  20. return $response;
  21. }
  22. }