Reputation: 9
I try to make download option in my laravel web project. Code 1:
public function downloadLogo()
{ return Response::download(images/logo.png); }
Code 2:
$file = public_path()."/images/logo.png";
$headers = array('Content-Type: application/png',);
return Response::download($file, 'logo.png',$headers);
None of them works. Any idea?
Upvotes: 0
Views: 691
Reputation: 328
Perhaps too late but here is the correct way to achieve this :
return Response::download( $file , 'logo.png' , array( 'Content-Type' => 'image/png' ) )->setContentDisposition('inline');
Upvotes: 1
Reputation: 3151
Try this,
$file = "images/logo.png";
$headers = array('Content-Type'=>'application/png');
return Response::download($file, 'logo.png',$headers);
Upvotes: 0