Double check and make sure that your form has enctype="multipart/form-data"
Apr 11, 2016
6
Level 2
Upload photo: Call to a member function getClientOriginalExtension() on a non-object
I have this function to store Article:
public function store(Requests\ArticleRequest $request) { $article = new Article($request->all()); $article['key']= str_random(30);
$imageName = $article['key'] . '.' .
$request->file('image')->getClientOriginalExtension();
$request->file('image')->move(
base_path() . '/public/images/catalog/', $imageName
);
Auth::user()->articles()->save($article);
Alert::success('SUPER!','Good job!')->persistent("Close");
return redirect('auctions');
}
offcource at blade view file I have:
{!! Form::label('Product Image') !!} {!! Form::file('image', null) !!}Now when I try to submit article everything is fine except image becouse I get error:
Call to a member function getClientOriginalExtension() on a non-object
How to solve this problem?
Please or to participate in this conversation.