-
Notifications
You must be signed in to change notification settings - Fork 1
/
bouncefile.php
33 lines (28 loc) · 1.14 KB
/
bouncefile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
if ( ! isset($_REQUEST['data']))
exit;
$data = $_REQUEST['data'];
$filename = isset($_REQUEST['filename']) ? $_REQUEST['filename'] : 'somefile.csv';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'text/csv';
$length = strlen($data);
header("Pragma: no-cache, public");
// header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Expires: 0");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $length");
print $data;
/*
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-type: application/x-unknown"); // I always use this
header("Content-Disposition: attachment; filename='theFilename.ext'");
header("Content-Transfer-Encoding: binary");
header("Content-Length: 177998"); // you might want to set this
readfile('/the/url/to/theFilename.ext');
*/