Newscoop\NewscoopBundle\Controller\SystemPrefController::maxUpload PHP Method

maxUpload() private method

Defines and sets max upload file size.
private maxUpload ( string $max_size, Symfony\Component\Translation\TranslatorInterface $translator ) : void | RedirectResponse
$max_size string Max upload file size
$translator Symfony\Component\Translation\TranslatorInterface Translator
return void | Symfony\Component\HttpFoundation\RedirectResponse
    private function maxUpload($max_size, $translator)
    {
        $max_upload_filesize_bytes = $this->convertToBytes($max_size);
        $preferencesService = $this->container->get('system_preferences_service');
        if ($max_upload_filesize_bytes > 0 && $max_upload_filesize_bytes <= min($this->convertToBytes(ini_get('post_max_size')), $this->convertToBytes(ini_get('upload_max_filesize')))) {
            $preferencesService->MaxUploadFileSize = strip_tags($max_size);
        } else {
            $this->get('session')->getFlashBag()->add('error', $translator->trans('newscoop.preferences.error.maxupload', array(), 'system_pref'));
            return $this->redirect($this->generateUrl('newscoop_newscoop_systempref_index'));
        }
    }