How create a file type field in custom entity programmatically?
The only way i have found is to move this param into the Entityform :

  $form['fid'] = array(
      '#type' =&gt; 'managed_file',
      '#upload_location' =&gt; 'public://produits/',
      '#default_value' =&gt; $entity-&gt;get('fid')-&gt;value,
      '#description' =&gt; t('png jpge jpg'),
      '#upload_validators' =&gt; array(
          'file_validate_extensions' =&gt; array('png jpg jpeg'),
      )
  );