Drupal 8:尝试读取上传的文件内容

I have a FileUploadForm, with a managed_file called "file" that I'm trying to read in submitForm.

This is what I tried so far, but the code throws an error.

public function submitForm(array &$form, FormStateInterface $form_state) {
  $file = $form_state->getValue('file');
  echo $file;

  $filename = $file->getFileUri();
  $handle = fopen($filename,"rb");
  $fsize = filesize($filename);
  $contents = fread($handle, $fsize);
  fclose($handle);
  drupal_set_message($contents);
}

In particular, I'm stuck with how to get the filename from the uploaded file.