Cara download banyak file sebagai Zip di Laravel
Bismillah.. backup kodingan
$zip = new \ZipArchive();
$zip->open('public/documents/mcm.zip', \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
// $data = \DB::table('upload_document')->where('kelompok_jawaban_revisi',$kelompok)->get();
// foreach ($data as $dt) {
$invoice_file = 'public/documents/'.$nama_file.'.pgp';
// $invoice_file2 = 'public/documents/'.$nama_file.'.csv';
$zip->addFile($invoice_file, $invoice_file);
// $zip->addFile($invoice_file2, $invoice_file2);
// dd(encrypt($invoice_file2));
// }
$zip->close();
// $gpg = new \gnupg();
// $gpg->seterrormode(\gnupg::ERROR_EXCEPTION);
// $info = $gpg->import($pubkey);
// $gpg->addencryptkey($info['fingerprint']);
// $uploadFileContent = file_get_contents('public/documents/'.$nama_file.'.csv');
// $enc = $gpg->encrypt($uploadFileContent);
// echo $enc;
// die;
// We return the file immediately after download
return response()->download('public/documents/mcm.zip');
Belum ada Komentar untuk "Cara download banyak file sebagai Zip di Laravel"
Posting Komentar