Shared upload folder in wordpress multisite

I have a wordpress multisite, where I would like all the images uploaded through the main site ( to be accessible to and All the images should be in one folder without subdirectory (e.g: wp-content/uploads/image.jpg).
I tried the bellow function, but my images for subdomains are uploaded to wp-content/uploads/sites/#blog_id/

function wpse_16722_upload_dir( $args ) {
    $newdir = '/';

    $args['path']    = str_replace( $args['subdir'], '', $args['path'] ); //remove default subdir
    $args['url']     = str_replace( $args['subdir'], '', $args['url'] );      
    $args['subdir']  = $newdir;
    $args['path']   .= $newdir; 
    $args['url']    .= $newdir; 

    return $args;
add_filter( 'upload_dir', 'wpse_16722_upload_dir' );

Solutions Collecting From Web of "Shared upload folder in wordpress multisite"

This will force uploads for all sites to the wp-content/uploads directory. Sub-directories (like year/month) will still exist (if the setting is enabled).

 * Force all network uploads to reside in "wp-content/uploads", and by-pass
 * "files" URL rewrite for site-specific directories.
 * @link
 * @param   array   $dirs
 * @return  array
function wpse_147750_upload_dir( $dirs ) {
    $dirs['baseurl'] = network_site_url( '/wp-content/uploads' );
    $dirs['basedir'] = ABSPATH . 'wp-content/uploads';
    $dirs['path'] = $dirs['basedir'] . $dirs['subdir'];
    $dirs['url'] = $dirs['baseurl'] . $dirs['subdir'];

    return $dirs;

add_filter( 'upload_dir', 'wpse_147750_upload_dir' );