Multiple upload image using managed_file I'm trying to do a very simple thing (seems not that simple at all) in my custom form, to add multiple files using the managed_file form api. Like in the admin, select a file, upload, then a new input file appears.

But I can't achieve that... do I need a callback ???

    'gallery' =&gt; array(
        '#type' =&gt; 'managed_file',  
        '#name' =&gt; 'gallery[]',
        '#title' =&gt; t('Gallery'),
        '#upload_location' =&gt; 'public://',
        '#attributes' =&gt; array(
            'multiple' =&gt; 'multiple',
        ),
    ),


Thanks
In Drupal 8, add '#multiple' => TRUE

Example:

$form['images'] = array(
  '#type' =&gt; 'managed_file',
  '#upload_location' =&gt; 'private://images/',
  '#multiple' =&gt; TRUE,
  '#upload_validators' =&gt; array(
    'file_validate_extensions' =&gt; array('png gif jpg jpeg'),
    'file_validate_size' =&gt; array(25600000),
    'file_validate_image_resolution' =&gt; array('800x600', '400x300'),
  ),
);


More about form api: Introduction to Form API