Making a file downloading system with valid input in a custom drupal 8 form I am trying to create a custom drupal 8 form, that is going to allow user to enter his/her firstname, lastname and email address, and if the user enters these credentials, will be able to download the file that I will upload to cms. This is how my form looks like right now:
 

namespace Drupal\whitepaper\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper;

class WhitePaperForm extends FormBase {

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

/**
 * {@inheritdoc}.
 */
   public function buildForm(array $form, FormStateInterface $form_state) {
  $form['iam'] = array(
   '#type' =&gt; 'select',
   '#title'=&gt;t('I am:'),
   '#options' =&gt; array(
    'dentist' =&gt; t('Dentist'),
    'broker' =&gt; t('Broker'),
    'engineer' =&gt; t('Engineer'),
   ),
   '#required' =&gt; TRUE,
  );
  $form['fname'] = array(
   '#type' =&gt; 'textfield',
   '#title' =&gt; $this-&gt;t('First Name:'),
   '#required' =&gt; TRUE,
  );
  $form['lname'] = array(
   '#type' =&gt; 'textfield',
   '#title' =&gt; $this-&gt;t('Last Name:'),
   '#required' =&gt; TRUE,
  );
  $form['email'] = array(
   '#type' =&gt; 'email',
   '#title' =&gt; $this-&gt;t('Your .com email address.'),
   '#required' =&gt; TRUE,
  );
  $form['show'] = array(
   '#type' =&gt; 'submit',
   '#value' =&gt; $this-&gt;t('Download Whitepaper'),
  );

  return $form;
}


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

  if (strpos($form_state['values']['email'], '.com') === FALSE ) {
    $this-&gt;setFormError('email', $form_state, $this-&gt;t('This is not a .com email address.'));
  } 
 }

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

  drupal_set_message($this-&gt;t('Your email address is @email', array('@email' =&gt; $form_state['values']['email'])));
 }
}


Can anyone help with a block of code that if the inputs are valid, when the user click download paper button, will be able to download? I got really stuck and i guess my point of view is not helpful to solve this problem.Thank you advanced.
you can do this with the $form_state->response($response)

  $response = new BinaryFileResponse($file-&gt;getFileUri();
  $form_state-&gt;setResponse($response);