How do I re-attach AJAX behaviours to a managed_file field?
The main problem is that you're not loading the form in Drupal way in the AJAX requests. When you use the normal jQuery ajax to load the form, then the necessary actions(Generating new scripts and re-attaching the behaviors) won't happen.

So you should follow the below process to achieve it.


Create a page with ajax Link/button - clicking on it should load the form(This
may change based on your need)
Create form generation callback
Create a ajax callback which will returns the form


Below is the complete example module which loads the form with the managed file field using ajax.

&lt;?php

/**
 * @file
 * Provides File module pages for testing purposes.
 */

/**
 * Implements hook_menu().
 */
function test_menu() {
  $items = array();

  $items['file/test'] = array(
    'title' =&gt; 'Managed file test',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('test_form'),
    'access arguments' =&gt; array('access content'),
  );
  $items['ajax/test'] = array(
    'title' =&gt; 'Managed file test',
    'page callback' =&gt; 'file_ajax_page',
    'access arguments' =&gt; array('access content'),
  );
  $items['ajax/form'] = array(
    'title' =&gt; 'Managed file test',
    'page callback' =&gt; 'file_ajax_form',
    'access arguments' =&gt; array('access content'),
  );

  return $items;
}

/**
 * Generates the Test page.
 */
function file_ajax_page() {
    // Make sure Drupal Ajax framework javascript is around.
  drupal_add_library('system', 'drupal.ajax');
  $output = '';
  // Generate a Ajax Link to load the form.
  $output .= l(t('Delete'), 'ajax/form', array('attributes' =&gt; array('class' =&gt; 'use-ajax')));
  // Specify the container for the form.
  $output .= '&lt;div class="form-container"&gt;&lt;/div&gt;';
    return $output;
}

/**
 * Returns the processed file form.
 */
function file_ajax_form() {
    $commands = array(); 

    // Treat them in Drupal way to load the form in AJAX, so that all the necessary scripts will be loaded.
  $commands[] = ajax_command_html('.form-container', drupal_render(drupal_get_form('test_form'))); 
  ajax_deliver( array(
    '#type' =&gt; 'ajax',
    '#commands' =&gt; $commands,
  ));
}

/**
 * Form constructor for testing a 'managed_file' element.
 *
 * @see file_module_test_form_submit()
 * @ingroup forms
 */
function test_form($form, &amp;$form_state, $tree = TRUE, $extended = FALSE, $default_fid = NULL) {
  $form['#tree'] = (bool) $tree;

  $form['nested']['file'] = array(
    '#type' =&gt; 'managed_file',
    '#title' =&gt; t('Managed file'),
    '#upload_location' =&gt; 'public://test',
    '#progress_message' =&gt; t('Please wait...'),
    '#extended' =&gt; (bool) $extended,
    '#size' =&gt; 13,
  );
  if ($default_fid) {
    $form['nested']['file']['#default_value'] = $extended ? array('fid' =&gt; $default_fid) : $default_fid;
  }

  $form['textfield'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Type a value and ensure it stays'),
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Save'),
  );

  return $form;
}

/**
 * Form submission handler for file_module_test_form().
 */
function test_form_submit($form, &amp;$form_state) {
  if ($form['#tree']) {
    $fid = $form['nested']['file']['#extended'] ? $form_state['values']['nested']['file']['fid'] : $form_state['values']['nested']['file'];
  }
  else {
    $fid = $form['nested']['file']['#extended'] ? $form_state['values']['file']['fid'] : $form_state['values']['file'];
  }
  drupal_set_message(t('The file id is %fid.', array('%fid' =&gt; $fid)));
}


This way Drupal will do all the works for you if you specify what/how do you want:)

I took File Test module in the core as the base for this example.