I'm using ZipArchive to generate a zip file of invoices, however, sometimes it fails to close the archive (afaik during $zip->close() happens the compression). What im trying to achieve is catching error code/text and returning a message to blade. I've tried using $zip->close() === FALSE and also try/catch, both failed. Here's the code piece:
$zip->addGlob($path.'*.pdf', GLOB_BRACE, $options);
$ret = $zip->close();
if($ret === TRUE){
return response()->download(storage_path('app/invoices/invoices_'.$role.'.zip'))->deleteFileAfterSend(true);
} else {
return back()->with('error', 'Failed with code '.$ret);
}
The point is that its supposed to return a notification to blade, instead id just gives an internal server error (ZipArchive::close(): Can't remove file: No such file or directory).
Thank you in advance.
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости