wp_upload_bits() is not giving the file path right in localhost

I ran into the same exact issue (getting paths like ‘X:xampphtdocswordpress/wp-content/uploads/2017/05/filename.jpg’ on WAMP on Windows). The issue seems to be due to update_post_meta() passing values through stripslashes() when storing the data.

The workaround is to add wp_slash() around your value you pass to update_post_meta().

You’re probably calling update_post_meta() something like this:

update_post_meta( $id, 'doesnt_work', $data );

You need to add wp_slash() to the data before or as you call update_post_meta()

update_post_meta( $id, 'does_work', wp_slash( $data ) );

The end result:

array ( 'file' => 'C:\\wamp64\\www\\wpdev\\wpdev_test/wp-content/uploads/2017/08/filename', ....