I need create zip file and download it, after delete, but after downloading Google Chrome give warning "is not commonly downloaded and may be dangerous" if i go to direct link and download file its working fine but download in php give warning. How i can fix it ?
$zip_file = public_path().'/storage/file.zip';
$zip = new ZipArchive();
if ( $zip->open($zip_file, ZipArchive::CREATE) !== TRUE) {
exit("message");
}
$zip->addFromString(basename('file.cs'),$plugin);
ob_clean();
ob_end_flush();
header("Cache-Control: public");
header('Content-Type: application/zip');
header("Content-Transfer-Encoding: Binary");
header("Content-Disposition: attachment; filename=\"".basename($zip_file)."\"");
header("Content-length: " . filesize($zip_file));
header("Pragma: no-cache");
header("Expires: 0");
readfile($zip_file);
unlink($zip_file);
exit();