diff --git a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
index 04ec605..1c4c23a 100644
--- a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
+++ b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
@@ -7,13 +7,18 @@
 
 namespace Drupal\Core\Form\EventSubscriber;
 
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\ReplaceCommand;
 use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
 use Drupal\Core\Form\FormAjaxException;
 use Drupal\Core\Form\FormAjaxResponseBuilderInterface;
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormBuilder;
 use Drupal\Core\Form\FormBuilderInterface;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
 use Symfony\Component\HttpKernel\KernelEvents;
 
 /**
@@ -64,9 +69,24 @@ public function onView(GetResponseForControllerResultEvent $event) {
    *   The event to process.
    */
   public function onException(GetResponseForExceptionEvent $event) {
+    $exception = $event->getException();
+    $request = $event->getRequest();
+
+    // Render a nice error message in case you have a file upload which exceeds
+    // the configured upload limit.
+    if ($exception instanceof BadRequestHttpException && $request->query->get(FormBuilder::AJAX_FORM_REQUEST)) {
+      drupal_set_message($exception->getMessage(), 'error');
+      $response = new AjaxResponse();
+      $status_messages = array('#type' => 'status_messages');
+      $response->addCommand(new ReplaceCommand(NULL, \Drupal::service('renderer')->renderRoot($status_messages)));
+      $response->headers->set('X-Status-Code', 200);
+      $event->setResponse($response);
+      return;
+    }
+
     // Extract the form AJAX exception (it may have been passed to another
     // exception before reaching here).
-    if ($exception = $this->getFormAjaxException($event->getException())) {
+    if ($exception = $this->getFormAjaxException($exception)) {
       $request = $event->getRequest();
       $form = $exception->getForm();
       $form_state = $exception->getFormState();
diff --git a/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php b/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php
index 293475c..7d1c4b7 100644
--- a/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php
@@ -71,7 +71,7 @@ public function buildResponse(Request $request, array $form, FormStateInterface
     if (empty($callback) || !is_callable($callback)) {
       throw new HttpException(500, 'The specified #ajax callback is empty or not callable.');
     }
-    $result = call_user_func_array($callback, [&$form, &$form_state]);
+    $result = call_user_func_array($callback, [&$form, &$form_state, $request]);
 
     // If the callback is an #ajax callback, the result is a render array, and
     // we need to turn it into an AJAX response, so that we can add any commands
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 0f31a1c..2fa31fa 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -22,6 +22,7 @@
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
 
 /**
  * Provides form building and processing.
@@ -264,6 +265,13 @@ public function buildForm($form_id, FormStateInterface &$form_state) {
     // can use it to know or update information about the state of the form.
     $response = $this->processForm($form_id, $form, $form_state);
 
+    // In case the post request exceeds the configured allowed size
+    // (post_max_size), the post request is potentially broken. Add some
+    // protection against that and at the same time have a nice error message.
+    if ($ajax_form_request && !isset($form_state->getUserInput()['form_id'])) {
+      throw new BadRequestHttpException(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))));
+    }
+
     // After processing the form, if this is an AJAX form request, interrupt
     // form rendering and return by throwing an exception that contains the
     // processed form and form state. This exception will be caught by
diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index 2b9aea3..f8a1cb0 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -328,20 +328,6 @@
       }
       else if (this.element && element.form) {
         this.url = this.$form.attr('action');
-
-        // @todo If there's a file input on this form, then jQuery will submit
-        //   the AJAX response with a hidden Iframe rather than the XHR object.
-        //   If the response to the submission is an HTTP redirect, then the
-        //   Iframe will follow it, but the server won't content negotiate it
-        //   correctly, because there won't be an ajax_iframe_upload POST
-        //   variable. Until we figure out a work around to this problem, we
-        //   prevent AJAX-enabling elements that submit to the same URL as the
-        //   form when there's a file input. For example, this means the Delete
-        //   button on the edit form of an Article node doesn't open its
-        //   confirmation form in a dialog.
-        if (this.$form.find(':file').length) {
-          return;
-        }
       }
     }
 
diff --git a/core/modules/file/file.routing.yml b/core/modules/file/file.routing.yml
index d9d4efa..b7d2e6a 100644
--- a/core/modules/file/file.routing.yml
+++ b/core/modules/file/file.routing.yml
@@ -1,12 +1,3 @@
-file.ajax_upload:
-  path: '/file/ajax'
-  defaults:
-    _controller: '\Drupal\file\Controller\FileWidgetAjaxController::upload'
-  options:
-    _theme: ajax_base_page
-  requirements:
-    _permission: 'access content'
-
 file.ajax_progress:
   path: '/file/progress'
   defaults:
diff --git a/core/modules/file/src/Controller/FileWidgetAjaxController.php b/core/modules/file/src/Controller/FileWidgetAjaxController.php
index 90176f8..ff0c537 100644
--- a/core/modules/file/src/Controller/FileWidgetAjaxController.php
+++ b/core/modules/file/src/Controller/FileWidgetAjaxController.php
@@ -7,13 +7,8 @@
 
 namespace Drupal\file\Controller;
 
-use Drupal\Component\Utility\NestedArray;
-use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\ReplaceCommand;
 use Drupal\system\Controller\FormAjaxController;
 use Symfony\Component\HttpFoundation\JsonResponse;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 
 /**
  * Defines a controller to respond to file widget AJAX requests.
@@ -21,74 +16,6 @@
 class FileWidgetAjaxController extends FormAjaxController {
 
   /**
-   * Processes AJAX file uploads and deletions.
-   *
-   * @param \Symfony\Component\HttpFoundation\Request $request
-   *   The current request object.
-   *
-   * @return \Drupal\Core\Ajax\AjaxResponse
-   *   An AjaxResponse object.
-   */
-  public function upload(Request $request) {
-    $form_parents = explode('/', $request->query->get('element_parents'));
-    $form_build_id = $request->query->get('form_build_id');
-    $request_form_build_id = $request->request->get('form_build_id');
-
-    if (empty($request_form_build_id) || $form_build_id !== $request_form_build_id) {
-      // Invalid request.
-      drupal_set_message(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))), 'error');
-      $response = new AjaxResponse();
-      $status_messages = array('#type' => 'status_messages');
-      return $response->addCommand(new ReplaceCommand(NULL, $this->renderer->renderRoot($status_messages)));
-    }
-
-    try {
-      /** @var $ajaxForm \Drupal\system\FileAjaxForm */
-      $ajaxForm = $this->getForm($request);
-      $form = $ajaxForm->getForm();
-      $form_state = $ajaxForm->getFormState();
-      $commands = $ajaxForm->getCommands();
-    }
-    catch (HttpExceptionInterface $e) {
-      // Invalid form_build_id.
-      drupal_set_message(t('An unrecoverable error occurred. Use of this form has expired. Try reloading the page and submitting again.'), 'error');
-      $response = new AjaxResponse();
-      $status_messages = array('#type' => 'status_messages');
-      return $response->addCommand(new ReplaceCommand(NULL, $this->renderer->renderRoot($status_messages)));
-    }
-
-    // Get the current element and count the number of files.
-    $current_element = NestedArray::getValue($form, $form_parents);
-    $current_file_count = isset($current_element['#file_upload_delta']) ? $current_element['#file_upload_delta'] : 0;
-
-    // Process user input. $form and $form_state are modified in the process.
-    $this->formBuilder->processForm($form['#form_id'], $form, $form_state);
-
-    // Retrieve the element to be rendered.
-    $form = NestedArray::getValue($form, $form_parents);
-
-    // Add the special Ajax class if a new file was added.
-    if (isset($form['#file_upload_delta']) && $current_file_count < $form['#file_upload_delta']) {
-      $form[$current_file_count]['#attributes']['class'][] = 'ajax-new-content';
-    }
-    // Otherwise just add the new content class on a placeholder.
-    else {
-      $form['#suffix'] .= '<span class="ajax-new-content"></span>';
-    }
-
-    $status_messages = array('#type' => 'status_messages');
-    $form['#prefix'] .= $this->renderer->renderRoot($status_messages);
-    $output = $this->renderer->renderRoot($form);
-
-    $response = new AjaxResponse();
-    $response->setAttachments($form['#attached']);
-    foreach ($commands as $command) {
-      $response->addCommand($command, TRUE);
-    }
-    return $response->addCommand(new ReplaceCommand(NULL, $output));
-  }
-
-  /**
    * Returns the progress status for a file upload process.
    *
    * @param string $key
diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php
index 066e33e..98603a2 100644
--- a/core/modules/file/src/Element/ManagedFile.php
+++ b/core/modules/file/src/Element/ManagedFile.php
@@ -7,11 +7,15 @@
 
 namespace Drupal\file\Element;
 
+use Drupal\Component\Utility\NestedArray;
 use Drupal\Component\Utility\Html;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\ReplaceCommand;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element\FormElement;
 use Drupal\Core\Url;
 use Drupal\file\Entity\File;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Provides an AJAX/progress aware widget for uploading and saving a file.
@@ -125,6 +129,53 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
   }
 
   /**
+   * #ajax callback for managed_file upload forms.
+   *
+   * This ajax callback takes care of the following things:
+   *   - Ensures that broken requests due to too big files are caught.
+   *   - Adds a class to the response to be able to highlight in the UI, that
+   *     a new file got uploaded.
+   *
+   * @param array $form
+   *   The build form.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The form state.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The current request.
+   *
+   * @return \Drupal\Core\Ajax\AjaxResponse
+   *   The ajax response of the ajax upload.
+   */
+  public static function uploadAjaxCallback(&$form, FormStateInterface &$form_state, Request $request) {
+    /** @var \Drupal\Core\Render\RendererInterface $renderer */
+    $renderer = \Drupal::service('renderer');
+
+    $form_parents = explode('/', $request->query->get('element_parents'));
+
+    // Retrieve the element to be rendered.
+    $form = NestedArray::getValue($form, $form_parents);
+
+    // Add the special Ajax class if a new file was added.
+    $current_file_count = $form_state->get('file_upload_delta_initial');
+    if (isset($form['#file_upload_delta']) && $current_file_count < $form['#file_upload_delta']) {
+      $form[$current_file_count]['#attributes']['class'][] = 'ajax-new-content';
+    }
+    // Otherwise just add the new content class on a placeholder.
+    else {
+      $form['#suffix'] .= '<span class="ajax-new-content"></span>';
+    }
+
+    $status_messages = array('#type' => 'status_messages');
+    $form['#prefix'] .= $renderer->renderRoot($status_messages);
+    $output = $renderer->renderRoot($form);
+
+    $response = new AjaxResponse();
+    $response->setAttachments($form['#attached']);
+
+    return $response->addCommand(new ReplaceCommand(NULL, $output));
+  }
+
+  /**
    * Render API callback: Expands the managed_file element type.
    *
    * Expands the file type to include Upload and Remove buttons, as well as
@@ -146,12 +197,10 @@ public static function processManagedFile(&$element, FormStateInterface $form_st
     $ajax_wrapper_id = Html::getUniqueId('ajax-wrapper');
 
     $ajax_settings = [
-      // @todo Remove this in https://www.drupal.org/node/2500527.
-      'url' => Url::fromRoute('file.ajax_upload'),
+      'callback' => [get_called_class(), 'uploadAjaxCallback'],
       'options' => [
         'query' => [
           'element_parents' => implode('/', $element['#array_parents']),
-          'form_build_id' => $complete_form['form_build_id']['#value'],
         ],
       ],
       'wrapper' => $ajax_wrapper_id,
diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index da48f74..05ce286 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -407,18 +407,15 @@ public static function process($element, FormStateInterface $form_state, $form)
     // file, the entire group of file fields is updated together.
     if ($element['#cardinality'] != 1) {
       $parents = array_slice($element['#array_parents'], 0, -1);
-      $new_url = Url::fromRoute('file.ajax_upload');
       $new_options = array(
         'query' => array(
           'element_parents' => implode('/', $parents),
-          'form_build_id' => $form['form_build_id']['#value'],
         ),
       );
       $field_element = NestedArray::getValue($form, $parents);
       $new_wrapper = $field_element['#id'] . '-ajax-wrapper';
       foreach (Element::children($element) as $key) {
         if (isset($element[$key]['#ajax'])) {
-          $element[$key]['#ajax']['url'] = $new_url->setOptions($new_options);
           $element[$key]['#ajax']['options'] = $new_options;
           $element[$key]['#ajax']['wrapper'] = $new_wrapper;
         }
@@ -451,6 +448,19 @@ public static function processMultiple($element, FormStateInterface $form_state,
     $element_children = Element::children($element, TRUE);
     $count = count($element_children);
 
+    // Count the amount of already uploaded files, in order to display new
+    // items in \Drupal\file\Element\ManagedFile::uploadAjaxCallback.
+    if (!$form_state->isRebuilding()) {
+      $count_items_before = 0;
+      foreach ($element_children as $children) {
+        if (!empty($element[$children]['#default_value']['fids'])) {
+          $count_items_before++;
+        }
+      }
+
+      $form_state->set('file_upload_delta_initial', $count_items_before);
+    }
+
     foreach ($element_children as $delta => $key) {
       if ($key != $element['#file_upload_delta']) {
         $description = static::getDescriptionFromElement($element[$key]);
diff --git a/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php b/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php
index 08ade26..f151c33 100644
--- a/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php
+++ b/core/modules/system/src/Tests/Ajax/AjaxFormCacheTest.php
@@ -64,7 +64,7 @@ public function testBlockForms() {
     $this->drupalPostAjaxForm(NULL, ['test1' => 'option1'], 'test1');
     $this->assertOptionSelectedWithDrupalSelector('edit-test1', 'option1');
     $this->assertOptionWithDrupalSelector('edit-test1', 'option3');
-    $this->drupalPostForm($this->getUrl(), ['test1' => 'option1'], 'Submit');
+    $this->drupalPostForm(NULL, ['test1' => 'option1'], 'Submit');
     $this->assertText('Submission successful.');
   }
 
