所以,当我想提交表单时,我就知道了:
Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)
我在php.ini中启用了 - php_fileinfo extension
。我也重新启动了我的localhost服务器。
这是我的规则:'img_1' => 'required|mimes:png,gif,jpeg',
这是我提交表格时得到的结果:
at MimeTypeGuesser->guess('C:\xampp\tmp\php2490.tmp') in File.php line 79
这是我上传图片的方式:
public function storeAuction(AuctionSubmitRequest $request)
{
$product = Product::create($request->all());
if(Input::hasfile('img_1'))
{
$request->file('img_1')->move(public_path('images'), $request->file('img_1')->getClientOriginalName());
$product->img_1 = 'images' . $request->file('img_1')->getClientOriginalName();
}
$product->user_id = Auth::user()->id;
$product->save();
return redirect('/');
}
答案 0 :(得分:0)
您必须从php.ini中注释掉以下行,然后重新启动您的apache
延长= php_fileinfo.dll