Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

download file laravel s3

$event_data = $this->ticket->where('user_id', $user_id)->first();
        
$data  = $event_data->pdf;

$get_ticket = 'tickets/'. $data;
$file_name  = "YOUR_DESIRED_NAME.pdf";

$headers = [
  'Content-Type'        => 'application/pdf',            
  'Content-Disposition' => 'attachment; filename="'. $file_name .'"',
];

return Response::make(Storage::disk('s3')->get($get_ticket), 200, $headers);
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #download #file #laravel
ADD COMMENT
Topic
Name
5+5 =