2

I use laravel framework v5.8 for my project and I need to upload video When the upload is complate it gives me Illuminate\Http\Exceptions\PostTooLargeException and when I disable this:

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

code in validatePostSize.php it gives me this:

error Warning: POST Content-Length of 16195196 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

and no file uploaded

php.ini settings:

upload_max_filesize=2000M
max_file_uploads=2000M
memory_limit=128M
post_max_size=800M

and I checked them in xampp phoInfo()

how can I resolved this.

htaccess code:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    php_value post_max_size=200M
    php_value upload_max_filesize=200M
</IfModule>
6
  • I check it now but nothing chaned Commented Sep 17, 2019 at 8:21
  • where did you check the phpinfo() ? Commented Sep 17, 2019 at 8:22
  • my xampp control panel Commented Sep 17, 2019 at 8:23
  • try phpinfo() in an example route in your laravel project. Route::get('test', function(){phpinfo();}); Commented Sep 17, 2019 at 8:37
  • I think this video can help Commented Sep 17, 2019 at 8:37

2 Answers 2

2

I solved this problem by creating php.ini file inside the public directory and restarted my apache and rerun PHP artisan serve command

new php.ini code:

[PHP]
upload_max_filesize=2000M
max_file_uploads=2000M
memory_limit=128M
post_max_size=800M
Sign up to request clarification or add additional context in comments.

Comments

0

This error message is an indication of that the file you are trying to upload is larger than your web host allows (default file upload size is 2 MB)

A solution is simple, need to increase the file size upload limit.

First of all, stop the XAMPP/Wamp then go to xampp\php\php.ini file, Find these lines in the php.ini file and replace it following numbers

upload_max_filesize = 64M

Save the changes, And then restart your XAMPP/Wamp, Also, refresh your website and try uploading the file again. You will now get success.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.