mercredi 9 novembre 2022

Laravel, download 2 files on one button click

I'm trying to make a feature where one button being clicked will access a single route and controller but the controller will sequentially download 2 files. The catch is they can't be zipped, they need to be downloaded sequentially as single files.

I've tried with this but I get an array to string conversion error.

public function fileDownload(){

    $first_file_name = 'test.xlsx';
    $first_file_path = storage_path("files/{$first_file_name}");

    $second_file_name = 'test2.xlsx';
    $second_file_path = storage_path("files/{$second_file_name}");  

    return \Response::download([$first_file_path, $second_file_path]);
}

Is there a way to do this in Laravel 5.3?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire