Use the “Media Library” in Frontend

Add below code to your current theme’s function.php

function add_media_upload_scripts() {
    if ( is_admin() ) {
         return;
       }
    wp_enqueue_media();
}
add_action('wp_enqueue_scripts', 'add_media_upload_scripts');

Further, you can explore more in detail by follow this blog (i.e. https://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/)