Custom Submit Handler issue in getting file I have the following custom submit handler.

function example_form_submit(&amp;$form, FormStateInterface $form_state) {
    $file = file_load($form_state['values']['file_fid']);//This works in 7
}


Now I want to have uploaded file information like fid, name etc. in D8. I am not able to get that.

UPDATE:
I have also tried using the following code from here but no luck.

if ($form_state-&gt;hasFileElement())
{
  drupal_set_message("This form has a file element.");
  $video_file_file_array = $form_state-&gt;getValue('video_file');
  if (is_array($video_file_file_array))
  {
    if (isset($video_file_file_array[0]))
    {
      $video_file_file_id = $video_file_file_array[0];
      $file = \Drupal\file\Entity\File::load($video_file_file_id);
      if ($file != NULL)
      {
        $filename = $file-&gt;getFilename();
        drupal_set_message('Filename: ' . $filename);
      }
    }
  }
}
You need to use following code to get it

$target_id =$form_state-&gt;getValue('field_name');//get the target_id from it 
    $file = \Drupal\file\Entity\File::load($target_id); //load the file and its attribute.
            $file_image= '&lt;img src = "' . \Drupal\image\Entity\ImageStyle::load('large')-&gt;buildUrl($file-&gt;getFileUri()) . '" /&gt;';//load the large image