I am following this topic to add a repeatable custom field for my Custom Post Type, but I cant get it to work for a media upload, Which will allow the author to add multiple image by uploading or choose from media gallery in a single project(my custom post type), my code is just the same so far, I just moved it to my custom post type.
You can use the Advanced Custom Fields plugin. It has a nice interface and does exactly what you're describing (you can put media upload fields in a repeater field). It has great documentation on how to retrieve the values on the front end.
If you'd like to hardcore everythings (which has its advantages) then don't use the plugin. If not; it will solve your problem :-)