How to change the wp_upload_dir() path in plugin

The upload directory and URL paths are stored in the options database. You can change them using update_option():

update_option( 'upload_path', ABSPATH . '/path/to/uploads' );
update_option( 'upload_path_url', site_url( '/uploads/' ) );

However, it’s best not to use this in a publiuc plugin, as it will cause numerous issues. We can instead hook into the filters that control the result of getting these options and set them to our custom paths:

function wpse_84046_upload_path( $path ) {
    return '/path/to/uploads';
}
add_filter( 'pre_option_upload_path', 'wpse_84046_upload_path' );

function wpse_84046_upload_path_url( $url ) {
    return site_url( '/uploads/' );
}
add_filter( 'pre_option_upload_path_url', 'wpse_84046_upload_path_url' );