File upload with meta box in wordpress with custom post type

From wordpress 3.0 version wordpress introduced the custom_post_type function. Many people want to attach the file field with add_meta_box function. In this tutorial I will tell you how to upload file with custom meta box and post type. In this tutorial I will show you how to create the custom post type and add custom meta boxes to that post type and upload file with custom meta box. After digging into wordpress files and functions I created following code. Just open your functions.php file and put following code in that file for creating custom post type.