Mercurial > hg > LGMap
annotate php/download.php @ 26:9f67e8afa1cc default tip
add new file for new LGService UI project
| author | Calvin Yeh <cyeh@mpiwg-berlin.mpg.de> |
|---|---|
| date | Thu, 28 Sep 2017 23:58:34 +0200 |
| parents | f17f43f0a63f |
| children |
| rev | line source |
|---|---|
| 11 | 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); | |
|
15
f17f43f0a63f
bug fixed: download error for data from LGDataverse
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
31 header('Content-Disposition: attachment; filename="download.kml"'); |
| 11 | 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 ?> |
