Creating an image upload input field I'm creating a image upload input field in blockForm which will output to Twig later. But got stuck due to some stuff.

public function blockForm($form, FormStateInterface $form_state){
        $form['image_file'] = [
            '#type' =&gt; 'managed_file',
            '#title' =&gt; $this-&gt;t('Upload Your Image'),
            '#default_value' =&gt; (isset($this-&gt;configuration['image_file']) ? $this-&gt;configuration['image_file'] : ""),
            '#weight' =&gt; '1',
            '#upload_location' =&gt; 'public://',
            '#upload_validators' =&gt; [
                'file_validate_extensions' =&gt; ['gif png jpg jpeg'],
            ],
        ];

       return $form;
    }


First thing is the '#upload_location', there are a lot of different answer online and the only difference is the path after public://, so I want to know what should I actually deal with it.

Second is the use, is there something missing or it is enough for achieve my goal.

The code I have now:

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilder;
use Drupal\Core\Link;
use Drupal\image\Entity\ImageStyle;
use Drupal\paragraphs\Entity\Paragraph;


Hope someone can answer and help. Many Thanks.
As i understand you could use something like this '#type' =&gt; 'file'

  $form['image_file']=array(  
    '#type' =&gt; 'file',
   '#title' =&gt; t('Upload YourImage'),
    '#upload_validators' =&gt; array(
    'file_validate_extensions' =&gt; array('gif'),),

        );
return $form;