0

I'm tring to download multiple PDFs using this method:

public function download(){
    $documents = Documents::all();
    foreach ($documents as $document) {
        response()->download(public_path("/uploads/documents/".$document->filename));
    }

    return 1;
}

This works, but only downloads one file. The other files aren't downloaded. Why?

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
jhon jhon
  • 1
  • 4
  • 1
    `response()->download()` triggers a download and exits the current code. If you want to download multiple files, you'll likely need to combine them first, i.e. into a `.zip` file or similar. – Tim Lewis Jun 07 '22 at 13:50
  • You can use like this https://stackoverflow.com/questions/36675505/laravel-5-multiple-download-file – RBC Jun 07 '22 at 14:00
  • you can use laravel jobs for download many files without zip – Gev99 Jun 07 '22 at 16:29

0 Answers0