Omen
Omen

Reputation: 85

Strange behaviour with image input in laravel 5.1

I have an issue with my current web project. I need to check if my request contains an input called image, so I just apply the normal method like so:

if($request->has('image'))
{
    ...
}

But for some reason, this is not working as shown below:

laravel

Can someone explain me why ?

Upvotes: 0

Views: 28

Answers (1)

Kalhan.Toress
Kalhan.Toress

Reputation: 21901

I think you need to access uploaded files as,

 $request->hasFile('image');

then it should be

if($request->hasFile('image')) { ...

see this DOC

Upvotes: 2

Related Questions