wp_handle_upload_prefilter valid date from input file

I want to ask some help, i’m having problem with thewp_handle_upload_prefilter
Here is the code:

add_filter('wp_handle_upload_prefilter','mdu_validate_image_size');
function mdu_validate_image_size( $file , $tmp_name) {        
        $maxWidth = 400;
        $maxHeight = 300;
        $file = $_FILES["bid_image"]['tmp_name'];
        list($width, $height) = getimagesize($file);

        if(($width >= $maxWidth) && ($height >= $maxHeight)) {
                $error = __("400x300 pixels, JPEG only", ET_DOMAIN);
                wp_send_json(array(
                    'success' => false,
                    'msg' => $error
                )); 
        }

        else if(($width <= $maxWidth) && ($height <= $maxHeight)) {
                $error = __("400x300 pixels, JPEG only", ET_DOMAIN);
                wp_send_json(array(
                    'success' => false,
                    'msg' => $error
                )); 
        } 
}

This code works, but there is one i’m missing, if i upload the image 400x300px, it still give me the $error.
now i tried to create this code:

if(($width == $maxWidth) && ($height == $maxHeight)) {
   //I leave here blank//
}

this doesn’t give me the $error but, the image is not showing.
my input code is this:

<input type="file" name="bid_image" id="bid_image"  accept="image/*" />

which part here I’m doing wrong?

thankyou

Solutions Collecting From Web of "wp_handle_upload_prefilter valid date from input file"