Search
 
SCRIPT & CODE EXAMPLE
 

PHP

download data from s3 and save to local disk laravel

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

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);
Comment

laravel s3 download file

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

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

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);
    }
Comment

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);
Comment

PREVIOUS NEXT
Code Example
Php :: PHP Warning: Module "curl" is already loaded in Unknown on line 0 
Php :: search line phpstorm mac 
Php :: magento 2 add cc transportbuilder 
Php :: IgasterLaravel ThemeExceptions heme Already Exists 
Php :: notify in piperx 
Php :: woocommerce coupon notifie a spefic email 
Php :: php sdk paytm 
Php :: Filtrer les articles WordPress mis en avant 
Php :: laravel defining relationship 
Php :: Add a watermark to a new PDF document 
Php :: SymfonyStyle 
Php :: php count words in string 
Php :: cidblike ci3 
Php :: expiry date alert in php 
Php :: php mysql text mark question 
Php :: php csv to multirow array $_FILES 
Php :: image_lib codeigniter add _thumb 
Php :: how to duplicate a database in phpmyadmin 
Php :: codeigniter set db prefix 
Php :: vault deployment in production 
Php :: codeigniter email validate and dublicate from database in php 
Php :: how to change css during holidays with php or Javascript in wordpress 
Php :: laravel 8 remove public from url 
Php :: union type php does not work 
Php :: @sectionMissing 
Php :: how to add user profile image in my account page in woocommerce 
Php :: when user click back clear form data laravel 
Php :: id de sesion php 
Php :: Separate A String Into Array Elements 
Php :: button onclick php 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =