Extend User plugin - add images field

Hello everyone,

I am trying to extend the User plugin to allow Frontend users to submit additional images to included by default. The addition of images works very well from the backend but not from the frontend. All fields (texts, avatar) are well updated except my new file type fields.

My Plugins.php file

<?php namespace LightLab\Extenduser;

use System\Classes\PluginBase;
use Rainlab\User\Controllers\Users as UsersController;
use Rainlab\User\Models\User as UserModel;

class Plugin extends PluginBase{
    public function registerComponents(){ }

    public function registerSettings() { }

    public function boot(){
        UserModel::extend (function ($model){
                    // Extend validation rules
                    $myrules = $model->rules; 
                    $myrules['country'] = 'required';
                    $myrules['city'] = 'required';
                    $model->rules = $myrules;
        	    $model->attachOne = [
        	   	'file' => \System\Models\File::class
        		'avatar' => \System\Models\File::class 
                        // I had to add the avatar field otherwise it didn't work anymore when I used attachOne here
                UsersController::extendFormFields(function($form, $model, $context){
                        'country' => [
                            'label' => 'Country',
                            'type'  => 'text'
                        'city' => [
                            'label' => 'City',
                            'type'  => 'text'
                        'file' => [
                            'label' => 'File',
                            'type'  => 'fileupload',
        					'mode'	=>  'image',
        					'imageHeight'	=> '260'

My Frontend form:

{{ form_ajax("account::onUpdate", {flash: true, validate: true, files: true}) }}
		<div class="field mb-4">
			<label for="country" class="required form-label">Country</label>
			<select name="country" id="country" class="w-100 form-select">
				<option value="">Choose from the list</option>
				<option value="FR" {% if form_value('country') == 'FR' %}selected{% endif %}>France</option>
			<span class="unValid" data-validate-for="country"></span>

		<div class="field mb-4">
			<label for="city" class="required form-label">City</label>
			<input type="text" name="city" value="{{ form_value('city') }}" id="city" class="w-100 form-control">
			<span class="unValid" data-validate-for="city"></span>

		<div class="field mb-4">
			<label for="file" class="required form-label">Add the file of ID</label>
			<input type="file" name="file" id="file" class="w-100 form-control">
			<span class="unValid" data-validate-for="file"></span>
			<button type="submit" data-attach-loading class="btn btn-primary my-2">Validate </button>

	{{ form_close() }}

Can you help me?

I did something similar to this by creating as onUpdate in my page PHP code section where I validated and saved the the custom fields.


I have the same issue. Has someone a solution?