L
L
lynnikvadim2015-11-08 23:34:44
Laravel
lynnikvadim, 2015-11-08 23:34:44

Why is Laravel file validation not working?

Code snippet :

if (Request::hasFile('img1'))
{
    	$file=$request->file('img1');
     	$f_name=$file->getClientOriginalName();
      $url_img='/site/img/product/'.$f_name;
      $file->move($root,$f_name);
     	$ProdModel->img1=$url_img;
}

But in response I get:
Non-static method Illuminate\Http\Request::hasFile() should not be called statically, assuming $this from incompatible context

Everything is as in the manual: laravel.su/docs/5.0/requests#files
What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2015-11-08
@lynnikvadim

use
$request->hasFile('img1');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question