$overrides['action'
] = 'wp_handle_mock_upload';
} $size_check = self::
check_upload_size( $files['file'
] );
if ( is_wp_error( $size_check ) ) { return $size_check;
} // Include filesystem functions to get access to wp_handle_upload().
require_once ABSPATH . 'wp-admin/includes/file.php';
$file =
wp_handle_upload( $files['file'
],
$overrides );
if ( isset( $file['error'
] ) ) { return new WP_Error( 'rest_upload_unknown_error',
$file['error'
],
array
( 'status' => 500
) );
} return $file;
}