1

I am working on file upload in Laravel 5.3. The file upload is working for the file with size less than 200 MB. Anything greater than 200 is failing. The strange reason for failure is when the upload file size is greater than 200 MB, the request obj is null. But same code works when the file size is less than 200 MB.

I have updated the php.ini and increased the file size as below and restarted apache. I have changed the following php.ini files.

/etc/php/5.6/cli/php.ini
/etc/php/5.6/apache2/php.ini

My phpinfo() returns following location for loaded configuration file.

Loaded Configuration File   /etc/php/5.6/apache2/php.ini

**post_max_size** = 1024M
**upload_max_filesize** = 1024M
**max_execution_time** = 120
**memory_limit** = 1024M

Below code is in my controller. The failure happens at log message with error message

exception 'ErrorException' with message 'Undefined index: selectedType'

I did a dump of $input and it returns empty for file size greater than 200 MB, but works with lesser size file.

public function postAdd(Request $request)
    {
        $input = $request->all(); 
        Log::info('In postAdd method  input selectedType '.$input['selectedType']);

My form has multipart enctype included.

  {!! Form::open([
                'files'  => true,
                'method' => 'POST',
                'route'  => $route,
                'enctype' => "multipart/form-data",
            ], [ 'class' => 'form' ]) !!}

                @include ('form' )

            {!! Form::close() !!}

Any idea why would the request obj become null? Any help or pointers are appreciated.

UPDATE:

I was able to get this resolved based on the comment from @user4892206 After changing the execution time to 600 seconds it started working.

NOTE: This is not a duplicate question. The other question mentioned about setting up post_max_size which was already done in my case. Anyways the execution time helped solve my problem.

Prabesh
  • 298
  • 1
  • 5
  • 12
  • I have checked the above link but as per that link php.ini file needs to be updated with post_max_size which i have already done and restarted apache. – Prabesh Feb 23 '18 at 18:27
  • 1
    It does not have to do something with the execution time? How long does the upload take? More than 120 seconds? – Michael W. Czechowski Feb 23 '18 at 18:30
  • 1
    Thanks @user4892206, your tip worked. After changing the execution time to 600 seconds it started working. Thanks a ton. This is not a duplicate question. The other question mentioned about setting up post_max_size which was already done in my case. Anyways the execution time helped solve my problem. – Prabesh Feb 26 '18 at 15:33

0 Answers0