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

s3 download files as zip laravel

composer require league/flysystem-ziparchive
Comment

s3 download files as zip laravel

composer require league/flysystem-ziparchive
Comment

s3 download files as zip laravel

<?php   
    use IlluminateSupportFacadesStorage;
    use LeagueFlysystemFilesystem;
    use LeagueFlysystemipArchiveipArchiveAdapter;

    Route::get('zip', function(){

        // see laravel's config/filesystem.php for the source disk
        $source_disk = 's3';
        $source_path = '';

        $file_names = Storage::disk($source_disk)->files($source_path);

        $zip = new Filesystem(new ZipArchiveAdapter(public_path('archive.zip')));

        foreach($file_names as $file_name){
            $file_content = Storage::disk($source_disk)->get($file_name);
            $zip->put($file_name, $file_content);
        }

        $zip->getAdapter()->getArchive()->close();

        return redirect('archive.zip');

    });
Comment

PREVIOUS NEXT
Code Example
Php :: woocommerce order status change 
Php :: mysql escape apostrophe 
Php :: laravel collection partition 
Php :: display pdf file in laravel 
Php :: codeigniter validation text length 
Php :: php json_encode indent 
Php :: php array serialize 
Php :: what is array_map in php 
Php :: laravel 8 validation unique 2 columns 
Php :: jquery is less than or equal to 
Php :: acf looping through post types 
Php :: xampp php 5.6 download 64 bit 
Php :: carbon if date is today 
Php :: laravel passport Route [login] not defined 
Php :: getimagesize php 
Php :: python to php converter online 
Php :: php call method from another class 
Php :: Laravel - Send mail using mail class 
Php :: php localhost 
Php :: PHP strrpos — Find the position of the last occurrence of a substring in a string 
Php :: session_regenerate_id 
Php :: preg_split 
Php :: php foreach skip to next 
Php :: php configuration in apache server 2.4 
Php :: laravel model where in 
Php :: reverse string php 
Php :: what is Laravel Eloquent ORM. 
Php :: wp-config.php 
Php :: get romawi number php 
Php :: on keyup jquery for search php on basis of class name 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =