If a content type has an image field then when the user creates new content, he is present with an image section on the form with a widget to "Browse" for a file. Clicking it provides a pop-up window standard dialog box for selecting a file. I would like to examine how this works to use it in a custom module, but cannot locate the code in the core modules.
The dialog box is a feature of your browser. The server sends HTML code looking something like
Most browsers render this by providing a text input field and a Browse button.
The code to generate a field upload form element is in
theme_file(). The code is very simple because all it does is to output an HTML file select form element. As explained in other answers, the files browsing dialog is provided by the web browser and, most of the time, re-uses the operating system native one.
You are confusing client side and server side. The code you are seeking is internal to the browser (the client); it is not within Drupal (the server).