Get contents of temporary uploaded file
You can't get the file from $form_state-&gt;getValue(). You have to upload the file first to the file table as temporary file with file_save_upload(). Then you can load the file content locally from $file-&gt;getFileUri().

  public function submitForm(array &amp;$form, FormStateInterface $form_state) {

    $validators = ['file_validate_extensions' =&gt; ['txt']];
    if ($file = file_save_upload('file', $validators, FALSE, 0)) {
      $data = file_get_contents($file-&gt;getFileUri());
      drupal_set_message($data);
    }

  }