diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
index 27ce2ab..1abbe35 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php
@@ -170,6 +170,7 @@ class FileItem extends EntityReferenceItem {
       '#description' => t('Separate extensions with a space or comma and do not include the leading dot.'),
       '#element_validate' => array(array(get_class($this), 'validateExtensions')),
       '#weight' => 1,
+      '#maxlength' => 256,
       // By making this field required, we prevent a potential security issue
       // that would allow files of any type to be uploaded.
       '#required' => TRUE,
diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index 2657289..c9e8d71 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -358,4 +358,41 @@ function testWidgetValidation() {
       $this->assertNoRaw($error_message, t('Validation error removed when file with correct extension uploaded (JSMode=%type).', array('%type' => $type)));
     }
   }
+
+  /**
+   * Tests widget settings.
+   */
+  function testWidgetSettings() {
+    $type_name = 'article';
+    $field_name = strtolower($this->randomName());
+    $settingsURL = "admin/structure/types/manage/$type_name/fields/node.$type_name.$field_name";
+
+    // Tests for the file field widget settings
+    // @var  $maxlength
+    $maxlength = 256;
+
+    // Create the file field
+    $this->createFileField($field_name, 'node', $type_name);
+
+    // The allowed file extensions should have the correct maxlenth
+    $this->drupalGet($settingsURL);
+    $file_extensions = $this->xpath('//input[@name="instance[settings][file_extensions]"]');
+    $this->assertEqual($file_extensions[0]['maxlength'], $maxlength, 'The file fields allowed file extensions #maxlength is 256.');
+
+    // We already tested to make sure the maxlength is 256.
+    // Now we test to make sure the maxlength, whatever it may be is respected.
+    $maxlength = $file_extensions[0]['maxlength'];
+    foreach (array($maxlength-1, $maxlength, $maxlength+1) as $length) {
+      $edit = array(
+        'instance[settings][file_extensions]' => $this->randomName($length),
+      );
+      $this->drupalPostForm($settingsURL, $edit, t('Save settings'));
+      if($length <= $maxlength){
+        $this->assertText(t("Saved $field_name configuration."), 'The allowed file extensions were successfully saved.');
+      } else {
+        $error_message = t('Allowed file extensions cannot be longer than %maxlength characters but is currently %length characters long.', array('%maxlength' => $maxlength, '%length' => $length));
+        $this->assertRaw($error_message, 'Validation error when allowed file extensions are longer than maxlength.');
+      }
+    }
+  }
 }
