Using hasFile() on RegistrationController gives error

Posted 1 month ago by codemode

Hi,

I'm trying to add an image upload field on User's registration.

The RegistrationController's create function seems to take 'array' as an argument instead of 'request' Looks like :

protected function create(array $data)

So here, when i do :

 if($data->hasFile('profilepic'))

When the register.blade.php has a simple file input field :

<input type="file" class="form-control @error('profilepic') is-invalid @enderror" name="profilepic" >

It given an error :

Call to a member function hasFile() on array

How can i call hasFile() on this function... and why is the parameter array instead of request here?

Many thanks!

Please sign in or create an account to participate in this conversation.