简体   繁体   English

laravel TokenMismatchException用于文件上传超过8MB

[英]laravel TokenMismatchException for file upload more than 8MB

When i upload below 8MB it works fine. 当我上传到8MB以下时,它可以正常工作。 But when the file is more than 8 MB It shows this error 但是当文件超过8 MB时,会显示此错误

(1/1) TokenMismatchException (1/1)TokenMismatchException

in VerifyCsrfToken.php (line 68) 在VerifyCsrfToken.php中(第68行)

at VerifyCsrfToken->handle(object(Request), object(Closure)) 在VerifyCsrfToken-> handle(object(Request),object(Closure))

in Pipeline.php (line 148) 在Pipeline.php中(第148行)

You need to change the value of upload_max_filesize and post_max_size in php.ini file located in your php root directory. 您需要在php根目录下的php.ini文件中更改upload_max_filesizepost_max_size的值。
Set it to your choice 设置为您的选择

upload_max_filesize = 100M
post_max_size = 100M

This happens when your file which you are uploading is smaller than the max upload size but more than the POST_MAX_SIZE. 当您要上传的文件小于最大上传大小但大于POST_MAX_SIZE时,就会发生这种情况。 The input is truncated at the POST_MAX_SIZE which means that the csrf token is lost. 输入在POST_MAX_SIZE处被截断,这意味着csrf令牌丢失。

You can change these values in php.ini file. 您可以在php.ini文件中更改这些值。 Make sure that both upload_max_filesize & post_max_size are same. 确保upload_max_filesize和post_max_size相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM