diff --git a/media.module b/media.module
index 1f97bcb..be047c2 100644
--- a/media.module
+++ b/media.module
@@ -713,10 +713,6 @@ function media_element_process($element, &$form_state, $form) {
   ctools_include('ajax');
   ctools_modal_add_js();
 
-  // Append the '-upload' to the #id so the field label's 'for' attribute
-  // corresponds with the textfield element.
-  $original_id = $element['#id'];
-  $element['#id'] .= '-upload';
   $fid = isset($element['#value']['fid']) ? $element['#value']['fid'] : 0;
 
   // Set some default element properties.
@@ -725,7 +721,7 @@ function media_element_process($element, &$form_state, $form) {
 
   $ajax_settings = array(
     'path' => 'media/ajax/' . implode('/', $element['#array_parents']) . '/' . $form['form_build_id']['#value'],
-    'wrapper' => $original_id . '-ajax-wrapper',
+    'wrapper' => $element['#id'] . '-ajax-wrapper',
     'effect' => 'fade',
   );
 
@@ -765,7 +761,7 @@ function media_element_process($element, &$form_state, $form) {
     '#field_prefix' => t('File ID'),
     '#size' => $element['#size'],
     '#theme_wrappers' => array(),
-    '#attributes' => array('class' => array('upload')),
+    '#attributes' => array('id' => $element['#id'], 'class' => array('upload')),
     '#weight' => -9,
   );
 
@@ -830,7 +826,7 @@ function media_element_process($element, &$form_state, $form) {
   $element['#attached']['library'][] = array('media', 'media_browser_settings');
 
   // Prefix and suffix used for Ajax replacement.
-  $element['#prefix'] = '<div id="' . $original_id . '-ajax-wrapper">';
+  $element['#prefix'] = '<div id="' . $element['#id'] . '-ajax-wrapper">';
   $element['#suffix'] = '</div>';
 
   return $element;
@@ -1022,7 +1018,8 @@ function theme_media_element($variables) {
 
   $attributes = array();
   if (isset($element['#id'])) {
-    $attributes['id'] = $element['#id'];
+    // Unique ID for the input wrapper to differ from the input.
+    $attributes['id'] = $element['#id'] . '-wrapper';
   }
   if (!empty($element['#attributes']['class'])) {
     $attributes['class'] = (array) $element['#attributes']['class'];
