[PHP] get zip file when visiting browser

With Apache + PHP
This code allows us to download a file zip from browser:


<?php

    $your_zip_file = "/path/to/your_zip_file.zip";

    $file_name = basename($yourfile);

    header("Content-Type: application/zip");
    header("Content-Disposition: attachment; filename=$file_name");
    header("Content-Length: " . filesize($your_zip_file ));

    readfile($your_zip_file );
    exit;

?>