lundi 23 novembre 2015

Laravel 5.1 file upload validation

I want to upload an image file using

  {!! Form::input('file','photo',null,['class'=>'photo_input']) !!}

Also my validation rules are

 public function rules()
{
    return [
       'username'=>'required|max:127|min:3|unique:users,username,'.$this->username,
       'email'=>'required|max:127|email|min:3|unique:users,email,'.$this->email,
       'password'=>'required|max:127|min:5|confirmed',
       'password_confirmation'=>'required|max:127|min:5|',
       'role'=>'required|max:127|min:5|in:programmer,admin,employee',
       'photo' => 'mimes:jpg,jpeg,bmp,png,gif'
    ];
}

But I get an error

The photo must be a file of type: jpg, jpeg, bmp, png, gif.

Whereas the file extension which I choose is jpg, so what's wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire