Pergunta

I have found the way to add Multiupload Filefield Widget into my custom form from this answer, https://drupal.stackexchange.com/questions/90637/does-multiupload-filefield-widget-for-drupal-provides-a-form-api-element/90658#90658?newreg=8dba9580e3d74b4d8b2cd1b140a4f08d

After adding the multiple file upload field into the form, and I try to upload some files, it won't show the list of uploaded files after the loading bar is gone.

Here is how I declare the field in my form:

$form['downloadsformset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Downloads'),
    '#collapsible' => TRUE,
    '#group' => 'myform'
);
$form['downloadsformset']['download_items'] = array(
    '#type'  => 'mfw_managed_file',
    '#title' => t('Download items'),
    '#description' => t('You are allow to upload jpg, jpeg, png and gif'),
    '#progress_indicator' => 'bar',
        '#upload_location'    => "public://dev/tmp",
    "#upload_validators"  => array(
        "file_validate_extensions" => array("png jpg jpeg"),
        'file_validate_size' => array(1024*1024*1024),
    ),
    '#group' => 'myform'
);

What I have missed in order to show the uploaded file list?

Foi útil?

Solução

You can try plupload module. This module also supports drag and drop file upload.

After installing module, you can do this in code,

$form['my_element'] = array(
  '#type' => 'plupload',

Outras dicas

It seems that the Multiupload Filefield Widget is not really meant to be used in the form API.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top