$s3_file = Storage::disk('s3')->get(request()->file);
$s3 = Storage::disk('public');
$s3->put("./file_name.tif", $s3_file);
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);
}
$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);