CMS
Version 3.9
download.inc
Go to the documentation of this file.
1
<?
2
/*
3
* Allow users to download/view a file uploaded through
4
* settings feature.
5
*/
6
Fakoli::using
(
"settings"
);
7
8
$setting_id
= checkNumeric($_GET[
"setting_id"
]);
9
10
$setting
=
new
Settings
(
$setting_id
);
11
12
$dir
=
$config
[
'uploadbase'
] . DIRECTORY_SEPARATOR;
13
14
trace(
"directory:dir:"
.
$dir
, 3);
15
16
$filepath
= sanitizePath(
$dir
.
$setting
->value);
17
$mimeType
= getMimeType(
$setting
->value);
18
19
trace(
"attachment download: filepath:"
.
$filepath
, 3);
20
$f
= fopen(
$filepath
,
"r"
);
21
$size
= filesize(
$filepath
);
22
23
header(
"Content-Disposition: attachment;filename=\""
. basename(
$setting
->value) .
"\""
);
24
header(
"Content-Type: $mimeType"
);
25
header(
"Content-Length: $size"
);
26
27
fpassthru(
$f
);
28
fclose(
$f
);
29
30
session_write_close();
31
?>
$dir
$dir
Definition:
download.inc:40
$f
$f
Definition:
download.inc:46
$filepath
$filepath
Definition:
download.inc:42
$mimeType
$mimeType
Definition:
download.inc:43
$size
$size
Definition:
download.inc:47
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
Settings
The Settings class provides components with a common API for specifying application settings and conf...
Definition:
settings.inc:49
$config
global $config
Definition:
import.inc:4
$setting_id
$setting_id
Definition:
download.inc:8
$setting
$setting
Definition:
download.inc:10
code
cms.sonjara.com
cms
components
settings
handlers
download.inc
Generated on Tue Mar 23 2021 15:36:11 for CMS by
1.9.1