Skip to content

Instantly share code, notes, and snippets.

@IonutBajescu
Created September 11, 2015 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IonutBajescu/27c43a095ebc2442bd20 to your computer and use it in GitHub Desktop.
Save IonutBajescu/27c43a095ebc2442bd20 to your computer and use it in GitHub Desktop.
stream binary
<?php
// ...
/**
* @Get("view/{file}", as="files.view")
*/
public function view(File $file)
{
$response = new BinaryFileResponse($file->getAbsolutePath());
$response->headers->set('Content-Disposition', 'inline; filename="' . $file->real_filename . '"');
return $response;
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment