How do I add code to browse for a file in a Drupal Form? I am trying to add items to a form (in code) similar to the add image item in the Drupal Add Content form that has the Browse and Upload buttons.  In Firefox, the Browse button invokes a Pop-up window to search files on the user's computer and returns the selected file &amp; path to the associated text box. I would like to review the code in Drupal to understand and duplicate the action. Thus far I cannot locate the code in core modules (its big in there and a file search does not find the word "Browse"!).  Does anyone know where the add content form is, or a reference site that explains it, or how to code it?
I recently created a few custom blocks with image upload and preview fields. Here's the relevant code that should be helpful for you:

function mymodule_block_configure($delta = '') {
  // Uploaded image path is saved in a variable.
  $pic_path = variable_get('mymodule_pic1', FALSE);
  $form = array();
  if ($pic_path) {
    $form['preview'] = array(
      '#markup' =&gt; '&lt;img src="'. image_style_url('mymodule_img_preview_style', $pic_path) .'" alt="'.t('Preview').'" /&gt;',
    );
  }
  // Image upload field.
  $form['image'] = array(
    '#type' =&gt; 'file',
    '#title' =&gt; t('Upload image from your computer'),
    '#description' =&gt; t('Allowed extensions: jpeg, jpg, png, gif'),
  );
  return $form;
}

function mymodule_block_save($delta = '', $edit = array()) {
  // Functionality to validate and save the file.
  $validators = array('file_validate_is_image' =&gt; array(), 'file_validate_extensions' =&gt; array('png gif jpg jpeg'));
  $file = file_save_upload('image', $validators, file_build_uri('mymodule_images'), FILE_EXISTS_REPLACE);
  if ($file) {
    $file-&gt;status |= FILE_STATUS_PERMANENT;
    $file = file_save($file);
    variable_set('mymodule_pic1', $file-&gt;destination);
  }
}