$ext = pathinfo($filename, PATHINFO_EXTENSION);
$allowed = array('jpg', 'png', 'jpeg');
if( in_array( $ext, $allowed ) ){
    foreach( $_FILES as $file ) {
        if( is_array( $file ) ) {
            // uygunsa
        } else {
            // değilse
        }
    }
}