laravel - Laravel文件上传错误Content-Length
问题描述
错误
Warning: POST Content-Length of 31492035 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
应用程序.php
'allowedFileTypes' => 'jpg,jpeg,bmp,png,pdf,mp4',
'maxFileSize' => 10000000000*2,
控制器创建
$rules = ['attachments.*' => 'required|mimes:'.$allowedFileTypes.'|max:'.$maxFileSize];
Storage::put($destinationPath.$fileName.'.'.$file->getClientOriginalExtension(),file_get_contents($file->getRealPath()));
解决方案
8388608 字节为 8M,PHP 中的默认限制。将您的 in php.ini 更新post_max_size
为更大的值。
upload_max_filesize
设置用户可以上传的最大文件大小,而 post_max_size 设置可以通过表单中的 POST 发送的最大数据量。
所以你可以做得upload_max_filesize
更大。
推荐阅读
- python - 当行中的值发生变化时,Pandas Dataframe cumsum 函数“重新启动”
- php - 尝试从静态页面发送电子邮件时出现错误 405
- eclipse - 如何在 Eclipse 中编码字符串?
- reactjs - React 无法识别导入的数组
- bitbucket - 提交拉取请求时完成的 Pytest + 覆盖回归测试(天蓝色管道和 bitbucket)
- gatsby - Gatsby 构建因 promise 失败。finally 不是函数
- c# - 如何检测用户是否单击控制台应用程序右上角的“X”按钮(C# .net)
- html - 无法将按钮向右移动并扩展输入以填充空间
- python - 给定一些约束,对等腰三角形的两个剩余顶点进行采样
- laravel - Laravel - 邮递员返回错误 500 内部服务器错误