public function store(Request $request)
{
$this->validate($request , [
'title'=> 'required|max:200',
'featured' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
'content' => 'required',
'category_id' => 'required',
]);
// dd(ini_get('upload_max_filesize'));
$featured = $request->featured;
$featured_new_name = time().$featured->getClientOriginalName();
$featured->move('uploads/posts' , $featured_new_name);
$post = Post::create([
'title' => $request->title,
'content' => $request->content,
'category_id' => $request->category_id,
'featured' => 'uploads/posts'. $featured_new_name
]);
return redirect()->back();
}
我的max_upload_size = 2g,max_file_uploads =20。我仍然收到此错误。 在我入睡之前一切正常,但是当我再次检查时出现此错误。
答案 0 :(得分:0)
您可能还忘记了将php.ini中的post_max_size
设置为2g
。
进行php.ini更改后,请不要忘记重新启动apache / web服务器。
答案 1 :(得分:0)
我的php.ini
很好,php.ini
一切正常。
我的数据库slug
中有一个列。默认情况下它不是null
,而且我没有在其中插入slug
。当我将其更改为Null
并再次提交后,它开始工作。
如果您的php.ini
文件没有问题,请检查您要在其中上传文件路径的数据库表。如果您有一列中没有保存值,并且默认情况下不是Null
,则将其更改为Null
。