Front-end Image Upload to Custom Meta Box

When I was working on the same the issue was that when you try to add custom meta box before the post is created it did not work. So what I did was once the post was created added the following code

$imagepath = wp_get_attachment_image_src( $upload[1], $size );
update_post_meta($post_id, 'image_path', $imagepath[0];

So what happen’s here is that $upload[1] is the image attachment id and using the wp_get_attachment_image_src i will get the source of the image url which you can attach to a custom post. Or you can use another function but this is pretty much. I am assuming you want a image path there are lot’s of other function’s you can use