Exemple #1
0
    // required for certain browsers
    header("Content-Type: " . $ctype);
    header("Content-Disposition: attachment; filename=\"" . $fileNameZip . "\";");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . $fsize);
    ob_clean();
    flush();
    readfile($fullFileNameZip);
    if (file_exists($fullFileNameZip)) {
        unlink($fullFileNameZip);
    }
}
try {
    //check parameters
    $query_arr = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
    $check = Helpers::validateExportParams($query_arr);
    if ($check != 'OK') {
        throw new Exception($check);
    }
    $layername = $query_arr["layer"];
    $map = $query_arr["map"];
    $format = $query_arr["format"];
    $cmd = $query_arr["cmd"];
    $ctype = "application/zip";
    if ($format == 'CSV') {
        $ctype = "text/csv";
    }
    //check if user is guest
    session_start();
    $user = null;
    if (isset($_SESSION["user_name"])) {