Response::download PHP Method

download() public static method

Create a new file download response.
public static download ( SplFileInfo | string $file, string $name = null, array $headers = [], string | null $disposition = 'attachment' ) : BinaryFileResponse
$file SplFileInfo | string
$name string
$headers array
$disposition string | null
return Symfony\Component\HttpFoundation\BinaryFileResponse
        public static function download($file, $name = null, $headers = array(), $disposition = 'attachment')
        {
            return \Illuminate\Routing\ResponseFactory::download($file, $name, $headers, $disposition);
        }

Usage Example

Example #1
0
 public function getDownload()
 {
     //PDF file is stored under project/public/download/info.pdf
     $file = public_path() . "/download/info.pdf";
     $headers = array('Content-Type: resume/docx');
     return Response::download($file, 'alexandra_gutierrez_resume.pdf', $headers);
 }
All Usage Examples Of Response::download