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