我昨天推出了一个早期测试网站。这是 vrep.io,我遇到了一个奇怪的问题。当上传大于 2mb 的图像(用户头像)时,laravel 验证器会返回“validation.uploaded”错误消息。
验证器代码:
protected function basicValidator( array $data ) {
return Validator::make( $data, [
'name' => 'required|min:2|max:255',
'occupation' => 'max:255',
'avatar' => 'mimes:jpeg,png,gif|dimensions:min_width=500,min_height=500|max:8000',
'drop-avatar' => 'in:1,0',
],
[
'avatar.mimes' => 'Uploaded file format should be jpeg, jpg, png or gif.',
'avatar.dimensions' => 'Image should have minimum 500x500px dimensions.',
'avatar.max' => 'Maximum allowed file size is 6 MB.',
] );
}
Run Code Online (Sandbox Code Playgroud)
我更改了当前的 php.ini 文件参数:
upload_max_filesize 100M
post_max_size 100M
memory_limit 256M
Run Code Online (Sandbox Code Playgroud)
它在AWS EC2实例上运行。UBUNTU 16.04 和 Nginx。
我还对 nginx 配置文件进行了更改: …