upload files dynamically to user folders

You can grab a WP_User instance with get_user_by()Codex documents that pretty well.

add_filter( 'upload_dir', 'userLoginUploadDir' );
function userLoginUploadDir( $args )
{
    // Assuming that your forms user login (search? autocomplete? AJAX-ified? foo?) is named
    // name="user_login" id="user_login"
    $userLogin = esc_attr( $_GET['user_login'] );
    $user = get_user_by( 'login', $userLogin );

    $upload_dir = wp_upload_dir();

    return array_merge( $upload_dir, array(
        # 'path'    => '',
        # 'url'     => '',
        'subdir'  => $user->user_login,
        # 'basedir' => '',
        # 'baseurl' => '',
    ) );
}

Basically it should be enough to only set the specific subdir key. The rest should be available from wp_upload_dir(). In any case: Don’t use constants for pathes or URLs/URIs. Use the functions as those are applying the needed filters.

tech