View:
<input type="file" name="photo">
<button class="btn">Send</button>
<input type="submit" value="send"> // I tested by input and button but it also does not work
Controller:
$f = $request->file("photo");
if($f->isValid()){
echo "upload"
$f->move("/public/upload/file.png");
}else{
echo 'not upload';
}
Error:
Fatal error: Call to a member function isValid() on null
I do not know why but I can not do upload images to the site. I've tried many ways but nothing works. Send files by request and get an error, I tried to use a Request::file('photo') or Input::file('photo')->isValid() but it not work too.
var_dump($request->file('prod_photo'));
If you will use such code in response gets NULL
EDIT:
$f = $request->file('photo');
if ($f->isValid()) {
$ext = $f->getClientOriginalExtension();
$org_name = $f->getClientOriginalName();
$r = rand(11111,999999);
$f->move("public/uploads", $r.$org_name);
//
}
How can I change the image size and check if the file is certainly the picture?