How to use the managed_file field in a custom form plugin
I think the issue we had was understanding the data that the form was sending back to us when using the 'managed_file' type. This creates an entity of File and stores the image information directly into the table called 'file_managed' in your database, but also saves the file to your directories based upon where you send it. So take this code for example:

$form['mainslider_slide_one']['image_dir'] = [
    '#type'                 =&gt; 'managed_file',
    '#upload_location'      =&gt; 'public://module-images/home-slider-images/',
    '#multiple'             =&gt; FALSE,
    '#description'          =&gt; t('Allowed extensions: gif png jpg jpeg'),
    '#upload_validators'    =&gt; [
      'file_validate_is_image'      =&gt; array(),
      'file_validate_extensions'    =&gt; array('gif png jpg jpeg'),
      'file_validate_size'          =&gt; array(25600000)
    ],
    '#title'                =&gt; t('Upload an image file for this slide')
];


For the '#upload_location' we are telling the file to be stored in our public folder under the specified directory (sites/sitename/files/ directory). So now we have the actual file stored where we want, as well as data stored in the database.

When we receive the information back (under validation for instance) we have the following code:

public function validateForm(array &amp;$form, FormStateInterface $form_state) {
    $managedFileId_imageOne = $form_state-&gt;getValue(['mainslider_slide_one' =&gt; 'image_dir']);

    if (empty($managedFileId_imageOne)) {
        $form_state-&gt;setErrorByName('test', 'No image found for image one');
    }
}


The result of $managedFileId_imageOne will either be an empty array (whereas I am sending an error message back) or an array of fid's.  The fid is the location in the database.  This is the information that we ended up saving into our settings file data. So when we pull the information into our program we are querying for the 'fid' located in the 'file_managed' table using the Entity::load method.

NOTE/UPDATE: 

Don't forget that files uploaded in this manner are currently, by default, set to be temporary (status column in the "file_managed" table). You need to set the file to permanent to manually set status to 1 so they are not temporary. I believe this is functionality that is currently a bug and they are looking into possibly updating this in future releases.

Sample from Jasodeep

   $image = $form_state-&gt;getValue('image');
   $file = File::load( $image[0] );
   $file-&gt;setPermanent();
   $file-&gt;save();


Hope this helps at least get you on your way!