Erreur malgré upload du bon fichier [closed]

Je suis confronté à un sérieux problème. J’ai un plugin wordpress dans lequel je souhaite récupérer la preuve de paiement avant de valider la commande. Malgré mes nombreux essaie je ne trouve pas ayant déjà essayer avec ce code, ça me renvoie l’erreur veuillez televerser un fichier même si je l’ai déjà televerser . Voici le fichier :

<?php

// Vérifie si WooCommerce est activé
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    add_action( 'plugins_loaded', 'momo_paid_payment_gateway' );
}

function momo_paid_payment_gateway() {
    class momo_paid_payment_gateway extends WC_Payment_Gateway {

        public function __construct() {
            $this->id                 = 'momo-paid';
            $this->icon               = plugins_url( '../images/icons.png', __FILE__ );
            $this->method_title       = __( 'MomoPaid', 'momo-paid' );
            $this->title              = $this->method_title;
            $this->has_fields         = true;
            $this->init_form_fields();
            $this->init_settings();
            $this->enabled            = $this->get_option( 'enabled' );
            $this->description        = __( 'MomoPaid: Recevez vos Paiements en ligne par MTN Mobile Money', 'momo-paid' );
            $this->method_description = $this->description;

            $this->recipient_number   = $this->get_option( 'recipient_number' );
            $this->recipient_name     = $this->get_option( 'recipient_name' );

            add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
            add_action( 'wp_enqueue_scripts', array( $this, 'payments_scripts' ) );
            add_action( 'woocommerce_checkout_process', array( $this, 'validate_fields' ) );
            add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_post_meta' ) );
            add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'display_transaction_id' ), 10 );
            add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'display_proof_file' ), 20 );
        }

        public function init_form_fields() {
            $this->form_fields = array(
                'enabled' => array(
                    'title'   => __( 'Activer/Desactiver MomoPaid', 'momo-paid' ),
                    'type'    => 'checkbox',
                    'label'   => __( 'Activer/Desactiver MomoPaid', 'momo-paid' ),
                    'default' => 'no',
                ),
                'recipient_name' => array(
                    'title'       => __( 'Identité du Bénéficiaire', 'momo-paid' ),
                    'type'        => 'text',
                    'description' => __( 'Nom du Bénéficiaire du paiement MTN Momo. <u><strong>E.g :</strong></u> Mamadou Diabate', 'momo-paid' ),
                ),
                'recipient_number' => array(
                    'title'       => __( 'Numéro du Bénéficiaire MTN Mobile Money', 'momo-paid' ),
                    'type'        => 'number',
                    'description' => __( 'Numéro du Bénéficiaire du Paiement. <u><strong>E.g :</strong></u> 2290197965267', 'momo-paid' ),
                ),
            );
        }

        public function payment_fields() {
            if ( is_checkout() ) {
                $recipient_name   = $this->recipient_name;
                $recipient_number = $this->recipient_number;

                if ( ! empty( $recipient_name ) || ! empty( $recipient_number ) ) {
                    momo_paid_payment_using_mobile_solutions( $recipient_name, $recipient_number );

                    echo '<br/></BLOCKQUOTE><div class="momo-money-form">';
                    woocommerce_form_field( '_momo_money', array(
                        'type'        => 'number',
                        'label'       => __( 'VÉRIFICATION MTN MOMO', 'momo-paid' ),
                        'placeholder' => __( '(XXXXXXXXXX)', 'momo-paid' ),
                        'required'    => true,
                        'class'       => array( 'form-row-wide' ),
                    ) );
                    echo '</div>';

                    echo '<div class="form-row form-row-wide">
                            <label for="momo_proof">' . esc_html__( 'Preuve de paiement (JPG, PNG, PDF – max 5MB)', 'momo-paid' ) . '</label>
                            <input type="file" name="momo_proof" id="momo_proof" accept=".jpg,.jpeg,.png,.pdf" required>
                          </div>';
                    echo '<br/><div class="momo-paid-know-before"></div>';
                } else {
                    esc_html_e( "Veuillez-bien contacter l'administrateur de ce site, un problème est survenu.", 'momo-paid' );
                }
            }
        }

        public function validate_fields() {
            if ( isset( $_POST['_momo_money'] ) ) {
                $transaction_id = sanitize_text_field( $_POST['_momo_money'] );
                if ( empty( $transaction_id ) ) {
                    wc_add_notice( __( 'L'ID de Transaction Momo Money ne peut être vide.', 'momo-paid' ), 'error' );
                } elseif ( ! preg_match( '/^d{10}$/', $transaction_id ) ) {
                    wc_add_notice( __( 'La valeur de la transaction doit contenir exactement 10 chiffres.', 'momo-paid' ), 'error' );
                }
            }

            if ( empty( $_FILES['momo_proof']['name'] ) ) {
                wc_add_notice( __( 'Veuillez fournir une preuve de paiement.', 'momo-paid' ), 'error' );
            } else {
                $file     = $_FILES['momo_proof'];
                $allowed  = array( 'jpg', 'jpeg', 'png', 'pdf' );
                $ext      = strtolower( pathinfo( $file['name'], PATHINFO_EXTENSION ) );
                $max_size = 5 * 1024 * 1024;

                if ( ! in_array( $ext, $allowed ) ) {
                    wc_add_notice( __( 'Format de fichier invalide. Seuls JPG, PNG et PDF sont autorisés.', 'momo-paid' ), 'error' );
                } elseif ( $file['size'] > $max_size ) {
                    wc_add_notice( __( 'Fichier trop volumineux. 5MB max.', 'momo-paid' ), 'error' );
                }
            }
        }

        public function save_post_meta( $order_id ) {
            if ( isset( $_POST['_momo_money'] ) ) {
                $transaction_id = sanitize_text_field( wp_unslash( $_POST['_momo_money'] ) );
                if ( preg_match( '/^d{10}$/', $transaction_id ) ) {
                    update_post_meta( $order_id, '_momo_money', $transaction_id );
                }
            }

            if ( ! empty( $_FILES['momo_proof']['name'] ) ) {
                require_once ABSPATH . 'wp-admin/includes/file.php';
                $uploaded = wp_handle_upload( $_FILES['momo_proof'], array( 'test_form' => false ) );
                if ( ! isset( $uploaded['error'] ) ) {
                    update_post_meta( $order_id, '_momo_proof_url', esc_url( $uploaded['url'] ) );
                }
            }
        }

        public function display_transaction_id( $order ) {
            if ( 'momo-paid' === $order->get_payment_method() ) {
                $transaction_id = get_post_meta( $order->get_id(), '_momo_money', true );
                if ( $transaction_id ) {
                    echo '<div class="order_data_column"><h4>' . esc_html__( 'NUMÉRO DE RÉFÉRENCE :', 'momo-paid' ) . ' ' . esc_html( $transaction_id ) . '</h4></div>';
                }
            }
        }

        public function display_proof_file( $order ) {
            if ( 'momo-paid' === $order->get_payment_method() ) {
                $proof_url = get_post_meta( $order->get_id(), '_momo_proof_url', true );
                if ( $proof_url ) {
                    $file_ext = pathinfo( $proof_url, PATHINFO_EXTENSION );
                    echo '<div class="order_data_column"><h4>' . esc_html__( 'Preuve de paiement :', 'momo-paid' ) . '</h4>';
                    if ( in_array( $file_ext, array( 'jpg', 'jpeg', 'png' ) ) ) {
                        echo '<img src="' . esc_url( $proof_url ) . '" style="max-width:200px;"><br>';
                    }
                    echo '<a href="' . esc_url( $proof_url ) . '" target="_blank">' . basename( $proof_url ) . '</a></div>';
                }
            }
        }

        public function process_payment( $order_id ) {
            $order = wc_get_order( $order_id );
            $order->update_status( 'on-hold', __( 'Votre paiement doit être vérifié, merci de bien vouloir patienter.', 'momo-paid' ) );
            WC()->cart->empty_cart();

            return array(
                'result'   => 'success',
                'redirect' => $this->get_return_url( $order ),
            );
        }

        public function payments_scripts() {
            // wp_enqueue_style( 'momo-paid-styles', plugin_dir_url( __FILE__ ) . 'css/momo-paid-styles.css', array(), '1.0' );
        }
    }
}

function momo_paid_add_gateway_class( $methods ) {
    $methods[] = 'momo_paid_payment_gateway';
    return $methods;
}
add_filter( 'woocommerce_payment_gateways', 'momo_paid_add_gateway_class' );

function momo_paid_payment_using_mobile_solutions( $recipient_name, $recipient_number ) {
    global $woocommerce;
    $cart_total_price = $woocommerce->cart->get_total();

    echo sprintf( __( '</br><strong>1°)</strong>  <strong>COMPOSER LE CODE USSD MOMO MONEY DE VOTRE PAYS POUR RÉGLER </strong><h4><strong>%1$s</h4></strong> À <strong>%2$s</strong> <strong>AU</strong> : <strong><h4 style="background-color:#f7e859;"> %3$s</h4></strong>.<br/><br/> <strong>2°) VÉRIFICATION PAR RÉFÉRENCE</strong> <br/>
    * <strong>Cette vérification initiale requiert le numéro de référence envoyé </strong>  <strong>dans l'accusé de réception par votre opérateur mobile après votre transaction</strong>.', 'momo-paid' ), wp_kses_post( $cart_total_price ), esc_html( $recipient_name ), esc_html( $recipient_number ) );
}

Quelqu’un peut me dire quoi faire ?