How to return a downloadable file in Laravel

Categorized as Laravel Tagged

If you need to return a downloadable file in Laravel, just do it with this easy technique – enable the download method on the response object. For example:

public function show()
{
  $file = public_path('misc/file.pdf');

  return response()->download($file);
}

Leave a reply

Your email address will not be published. Required fields are marked *