Answers for "how to download file from s3 bucket using laravel"

PHP
0

laravel s3 download file

return Storage::download('file.jpg');

return Storage::download('file.jpg', $name, $headers);
Posted by: Guest on August-05-2020
0

laravel download file from s3

$attachment = TicketAttachment::find($id);
$headers = [
    'Content-Type'        => 'application/jpeg',
    'Content-Disposition' => 'attachment; filename="'. $attachment->name .'"',
];
return \Response::make(Storage::disk('s3')->get($attachment->url), 200, $headers);
Posted by: Guest on October-21-2020
0

download file laravel s3

public function downloadAsset($id)
    {
        $asset = Asset::find($id);
        $assetPath = Storage::disk('s3')->url($asset->filename);

        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename=" . basename($assetPath));
        header("Content-Type: " . $asset->mime);

        return readfile($assetPath);
    }
Posted by: Guest on January-25-2022
0

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);
Posted by: Guest on January-25-2022

Code answers related to "how to download file from s3 bucket using laravel"

Browse Popular Code Answers by Language