Commit 19834368 authored by Vassilis Kanellopoulos's avatar Vassilis Kanellopoulos
Browse files

set max upload file size

parent aceca535
...@@ -12,6 +12,7 @@ return [ ...@@ -12,6 +12,7 @@ return [
'file_upload' => [ 'file_upload' => [
'tmp_path' => 'data/tmp', 'tmp_path' => 'data/tmp',
'target_path' => 'data/uploads', 'target_path' => 'data/uploads',
'max_size' => '5MB',
], ],
], ],
]; ];
...@@ -218,10 +218,12 @@ return function (Slim\App $app) { ...@@ -218,10 +218,12 @@ return function (Slim\App $app) {
$container[InputFilter\Lab::class] = function ($c) { $container[InputFilter\Lab::class] = function ($c) {
$settings = $c->get('settings'); $settings = $c->get('settings');
$uploadTmpPath = $settings['schools']['file_upload']['tmp_path']; $uploadTmpPath = $settings['schools']['file_upload']['tmp_path'];
$attachmentSize = $settings['schools']['file_upload']['max_size'];
return new InputFilter\Lab( return new InputFilter\Lab(
$uploadTmpPath, $uploadTmpPath,
$c->get(Service\LabServiceInterface::class) $c->get(Service\LabServiceInterface::class),
$attachmentSize
); );
}; };
......
...@@ -22,7 +22,8 @@ class Lab ...@@ -22,7 +22,8 @@ class Lab
public function __construct( public function __construct(
$uploadTmpPath, $uploadTmpPath,
LabServiceInterface $labService LabServiceInterface $labService,
$attachmentSize
) { ) {
$id = new Input('id'); $id = new Input('id');
$id->setRequired(false) $id->setRequired(false)
...@@ -82,6 +83,9 @@ class Lab ...@@ -82,6 +83,9 @@ class Lab
'image/svg+xml', 'image/svg+xml',
'image/svg+xml', 'image/svg+xml',
'image/vnd.adobe.photoshop', 'image/vnd.adobe.photoshop',
]))
->attach(new Validator\File\Size([
'max' => $attachmentSize,
])); ]));
$use_ext_program= new Input('use_ext_program'); $use_ext_program= new Input('use_ext_program');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment