Drupal 8 – Form file upload handling

I am using following code to upload a file.

a) Before SAVE button is pressed on the form, as soon as I upload a file, it is saved at my local drive i.e ‘sites/default/files/my_files’. How can I control so as file is only uploaded once SAVE button is pressed.

b) How can I get file details i.e upload file name, size etc.

****************

<?php

/**
 * @file
 * Contains Drupalmy_moduleFormFileFormAdd.
 */

namespace Drupalmy_moduleForm;

use DrupalCoreFormFormBase;
use DrupalCoreFormFormStateInterface;

/**
 * ..........
 *
 * @todo
 *   sanitation.
 */
class FileFormAdd extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'my_module_file';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = array(
      '#attributes' => array('enctype' => 'multipart/form-data'),
    );
    
    $form['file_upload_details'] = array(
      '#markup' => t('<b>The File</b>'),
    );
	
    $validators = array(
      'file_validate_extensions' => array('pdf'),
    );
    $form['my_file'] = array(
      '#type' => 'managed_file',
      '#name' => 'my_file',
      '#title' => t('File *'),
      '#size' => 20,
      '#description' => t('PDF format only'),
      '#upload_validators' => $validators,
      '#upload_location' => 'public://my_files/',
    );
    
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary',
    );
    
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {    
    if ($form_state->getValue('my_file') == NULL) {
      $form_state->setErrorByName('my_file', $this->t('File.'));
    }
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

	// Need to get file details i.e upload file name, size etc.

    dpm($form_state->getValue('my_file'));

    // Display success message.
    drupal_set_message('AMS file successfully uploaded.');

    // Redirect.
//    $form_state->setRedirect('my_module._______');
  }

}
Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed