Hello, Thank you so much for sharing this! This is exactly what I need :) I believe these lines are not necessary: ``` $form['#attributes'] = [ 'enctype' => 'multipart/form-data', ]; ``` as it is automatically added to the form when we add a FormElement of type 'file' see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21File.php/class/File/8.2.x "If you add this element to a form the enctype="multipart/form-data" attribute will automatically be added to the form element."