Onyx
Onyx

Reputation: 5782

Getting if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {throw new PostTooLargeException;} exception

Whenever I try to upload a really big > 30MB image, I get this exception:

public function handle($request, Closure $next)
    {
        $max = $this->getPostMaxSize();
 
        if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
            throw new PostTooLargeException;
        }
 
        return $next($request);
    }

I've not set a validator for max image size in my ImagesController where my uploadImage() function is and I've set upload_max_filesize = 100M. This is why I have no clue why is this exception being thrown.

Upvotes: 1

Views: 2114

Answers (1)

Chetam Okafor
Chetam Okafor

Reputation: 573

In the php.ini file set post_max_size =and upload_max_filesize = your maximum file size eg; post_max_size = 126MB

This solved my problem and I hope it helps.

Upvotes: 1

Related Questions