Yngvarr

Generation

generate functionSat, 07 Jan 2023

pack to gz and return archive file download

<?php function pack_to_gz($file) { $zip = new ZipArchive; $filename = $file . ".gz"; //$zip->open($filename, ZipArchive::CREATE); //$zip->addFile($file); //$zip->close(); //header('Content-Type: application/zip'); //header('Content-disposition: attachment; filename=' . $filename); //header('Content-Length: ' . filesize($filename)); //readfile($filename); //return $filename; } pack_to_gz('/Users/danghong/Desktop/d-hong.com.zip'); ?>

Questions about programming?Chat with your personal AI assistant