“Unduh File Laravel S3” Kode Jawaban

Unduh Data dari S3 dan Simpan ke Disk Lokal Laravel

 $s3_file = Storage::disk('s3')->get(request()->file);
 $s3 = Storage::disk('public');
 $s3->put("./file_name.tif", $s3_file);
Happy Hamerkop

Laravel S3 Unduh File

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

return Storage::download('file.jpg', $name, $headers);
TP

Laravel Unduh File dari 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);
Modern Magpie

Unduh 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);
Nice Nightingale

Unduh 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);
    }
Nice Nightingale

Jawaban yang mirip dengan “Unduh File Laravel S3”

Pertanyaan yang mirip dengan “Unduh File Laravel S3”

Lebih banyak jawaban terkait untuk “Unduh File Laravel S3” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya