App: add upload_max_filesize config parameter to set upload_max_filesize & upload_max_filesize
This commit is contained in:
parent
d461b28b7d
commit
c346252f55
3 changed files with 18 additions and 4 deletions
|
@ -7,9 +7,13 @@ data_directory: "${root_directory_path}/data"
|
||||||
# Temporary files root directory
|
# Temporary files root directory
|
||||||
tmp_root_directory: "${data_directory}/tmp"
|
tmp_root_directory: "${data_directory}/tmp"
|
||||||
|
|
||||||
# Temporary uploading files directory
|
# Temporary uploading files directory (optional, default: PHP ini default)
|
||||||
upload_tmp_directory: ${tmp_root_directory}/uploading"
|
upload_tmp_directory: ${tmp_root_directory}/uploading"
|
||||||
|
|
||||||
|
# Uploading file size limit (in bytes, example: 104857600 == 100Mb)
|
||||||
|
# (optional, default: PHP ini default)
|
||||||
|
upload_max_filesize: 104857600
|
||||||
|
|
||||||
# Main pagetitle
|
# Main pagetitle
|
||||||
main_pagetitle: "Eesyphp"
|
main_pagetitle: "Eesyphp"
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,13 @@ data_directory: "${root_directory_path}/data"
|
||||||
# Temporary files root directory
|
# Temporary files root directory
|
||||||
tmp_root_directory: "${data_directory}/tmp"
|
tmp_root_directory: "${data_directory}/tmp"
|
||||||
|
|
||||||
# Temporary uploading files directory
|
# Temporary uploading files directory (optional, default: PHP ini default)
|
||||||
upload_tmp_directory: ${tmp_root_directory}/uploading"
|
upload_tmp_directory: ${tmp_root_directory}/uploading"
|
||||||
|
|
||||||
|
# Uploading file size limit (in bytes, example: 104857600 == 100Mb)
|
||||||
|
# (optional, default: PHP ini default)
|
||||||
|
upload_max_filesize: 104857600
|
||||||
|
|
||||||
# Main pagetitle
|
# Main pagetitle
|
||||||
main_pagetitle: "Eesyphp"
|
main_pagetitle: "Eesyphp"
|
||||||
|
|
||||||
|
|
10
src/App.php
10
src/App.php
|
@ -51,8 +51,14 @@ class App {
|
||||||
$sentry_span = new SentrySpan('app.init', 'Application initialization');
|
$sentry_span = new SentrySpan('app.init', 'Application initialization');
|
||||||
|
|
||||||
// Define upload_tmp_dir
|
// Define upload_tmp_dir
|
||||||
if (is_string(self::get('upload_tmp_directory')))
|
if (self::isset('upload_tmp_directory'))
|
||||||
ini_set('upload_tmp_dir', self::get('upload_tmp_directory'));
|
ini_set('upload_tmp_dir', self::get('upload_tmp_directory', null, 'string'));
|
||||||
|
if (self::isset('upload_max_filesize')) {
|
||||||
|
ini_set('upload_max_filesize', self::get('upload_max_filesize', null, 'string'));
|
||||||
|
// post_max_size must be larger than upload_max_filesize
|
||||||
|
// See: https://www.php.net/manual/en/ini.core.php#ini.post-max-size
|
||||||
|
ini_set('post_max_size', strval(self::get('upload_max_filesize', null, 'int') * 1.1));
|
||||||
|
}
|
||||||
|
|
||||||
if (self :: get('log.enabled', true, 'bool'))
|
if (self :: get('log.enabled', true, 'bool'))
|
||||||
Log::init();
|
Log::init();
|
||||||
|
|
Loading…
Reference in a new issue