When uploading a picture with laravel, the upload fails when the picture is larger than 2m.

the configuration of both PHP and nginx has been modified to allow 50m files to be uploaded
but this error is still reported

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
No message

Properties of the form form

<form class="form-horizontal form-material" id="login" enctype="multipart/form-data" method="post" action="{{ url("/certify") }}">

there is also a csrf on the button of the form

<div class="form-group text-center m-t-20" style="clear: both;">
     <div class="col-xs-10" style="margin-top: 15px">
          <button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" type="submit"></button>
              {{ csrf_field() }}
      </div>
</div>

definition of routes

Route::post("/certify", "LoginController@loginCertify");
Mar.30,2021

should not be this mistake?
your ability to pass less than 2m?
the current error is because the request method is incorrect, such as the definition of POST,. You use GET to request

. < hr >

main configurations that need to be changed
post_max_size, upload_max_filesize in php
client_max_body_size in nginx
need to be restarted after modification


agree with the statement above, and suspect that you posted the wrong message incorrectly. the METHOD, used by MethodNotAllowedHttpException to determine the request has nothing to do with the size of the uploaded file. The laravel source code is as follows

MethodNotAllowedHttpException

// file vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php 12-31
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpKernel\Exception;

/**
 * @author Kris Wallsmith <kris@symfony.com>
 */
class MethodNotAllowedHttpException extends HttpException
{
    /**
     * @param array      $allow    An array of allowed methods
     * @param string     $message  The internal exception message
     * @param \Exception $previous The previous exception
     * @param int        $code     The internal exception code
     */
    public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0)
    {
        $headers = array('Allow' => strtoupper(implode(', ', $allow)));

        parent::__construct(405, $message, $previous, $headers, $code);
    }
}
  • Laravel directory permission problem

    problem description laravel framework, you need to change the permissions of storage and bootstrap directories to 777 before you can access them, otherwise you will not have permission. Change it locally to 777, no problem. After the completion of fun...

    May.22,2021
  • Why can't my laravel get get data?

    problem description Why can t my laravel get get data? the environmental background of the problems and what methods you have tried look at the picture related codes Please paste the code text below (do not replace the code with pictures)...

    Mar.14,2022
Menu