Answer the question
In order to leave comments, you need to log in
How to save the file correctly?
Controller:
public function store(Request $request)
{
...
$image_file = Request::file('image');
if (Request::hasFile('image'))
{
$image_file->move('/testupload');
}
...
}
{!! Form::file('image', null, ['class' => 'form-control']) !!}
Non-static method Illuminate\Http\Request::file() should not be called statically, assuming $this from incompatible context
Answer the question
In order to leave comments, you need to log in
So the error says that the method of the Request object is not static and must be called through an object instance:
$request->file('image');
if ($request->hasFile('image')) {
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question