protected function getAutomaticChunkSize()
    {
        $nh = $this->app->make('helper/number');
        // Maximum size of an uploaded file, minus a small value (just in case)
        $uploadMaxFilesize = (int) $nh->getBytes(ini_get('upload_max_filesize')) - 100;
        // Max size of post data allowed, minus enough space to consider other posted fields.
        $postMaxSize = (int) $nh->getBytes(ini_get('post_max_size')) - 10000;
        if ($uploadMaxFilesize < 1 && $postMaxSize < 1) {
            return 2000000;
        }
        if ($uploadMaxFilesize < 1) {
            return $postMaxSize;
        }
        if ($postMaxSize < 1) {
            return $uploadMaxFilesize;
        }

        return min($uploadMaxFilesize, $postMaxSize);
    }