11
|
1 <?php
|
0
|
2 <?php
|
|
3 /*
|
|
4 * proxy.php
|
|
5 *
|
|
6 * Copyright (c) 2013, Sebastian Kruse. All rights reserved.
|
|
7 *
|
|
8 * This library is free software; you can redistribute it and/or
|
|
9 * modify it under the terms of the GNU Lesser General Public
|
|
10 * License as published by the Free Software Foundation; either
|
|
11 * version 3 of the License, or (at your option) any later version.
|
|
12 *
|
|
13 * This library is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16 * Lesser General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU Lesser General Public
|
|
19 * License along with this library; if not, write to the Free Software
|
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
21 * MA 02110-1301 USA
|
|
22 */
|
|
23
|
|
24 if (!empty($_POST['file'])) {
|
|
25
|
|
26 $file = $_POST['file'];
|
|
27 $filesize = strlen($file);
|
|
28
|
|
29 $mime = array('application/octet-stream');
|
|
30
|
|
31 header('Content-Type: '.$mime);
|
11
|
32 header('Content-Disposition: attachment; filename="download.kml"');
|
0
|
33 header('Content-Transfer-Encoding: binary');
|
|
34 header('Content-Length: '.sprintf('%d', $filesize));
|
|
35 header('Expires: 0');
|
|
36
|
|
37 // check for IE only headers
|
|
38 // credits to: cballou, http://stackoverflow.com/questions/2019964/php-form-download-to-zip
|
|
39 if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
|
40 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
|
41 header('Pragma: public');
|
|
42 } else {
|
|
43 header('Pragma: no-cache');
|
|
44 }
|
|
45
|
|
46 echo $file;
|
|
47 }
|
|
48 ?> |