Drupal 7 使用托管文件以自定义形式进行多文件上载

Drupal 7 使用托管文件以自定义形式进行多文件上载,drupal-7,form-api,Drupal 7,Form Api,我正在Drupal7中构建一个自定义设置表单,其中包含一个图像上传字段。此图像字段应允许多次上载 经过一些研究,我发现你可以用托管的_文件和属性=>数组('multiple'=>'multiple')来实现这一点。然而,这似乎没有任何作用 这是我目前拥有的代码: $form['frontpage_banner_images'] = array( '#type' => 'managed_file', '#title' => t('Frontpage Images'), '#

我正在Drupal7中构建一个自定义设置表单,其中包含一个图像上传字段。此图像字段应允许多次上载

经过一些研究,我发现你可以用
托管的_文件
属性=>数组('multiple'=>'multiple')
来实现这一点。然而,这似乎没有任何作用

这是我目前拥有的代码:

$form['frontpage_banner_images'] = array(
  '#type' => 'managed_file',
  '#title' => t('Frontpage Images'),
  '#name' => 'files[]',
  '#attributes' => array(
    'multiple' => 'multiple',
    'class' => 'testclass',
  ),
  '#upload_location' => 'public://homepage-banners/',
  '#default_value' => variable_get('frontpage_banner_images'),
);
因此:

<div class="form-item form-type-managed-file form-item-files-">
  <label for="edit-frontpage-banner-images-upload">Frontpage Images</label>
  <div id="edit-frontpage-banner-images-upload" class="testclass form-managed-file">
    <input type="file" id="edit-frontpage-banner-images-upload" name="files[frontpage_banner_images]" size="22" class="form-file">
    <input type="submit" id="edit-frontpage-banner-images-upload-button" name="frontpage_banner_images_upload_button" value="Upload" class="form-submit ajax-processed">
    <input type="hidden" name="frontpage_banner_images[fid]" value="0">
  </div>
</div>

首页图像
如您所见,my
#attributes
中的
testclass
应用于包装
div
而不是文件输入。因此,
multiple
属性没有任何作用

这就是我想要实现的目标(Photoshopped):


感谢您对如何实现这一目标的任何帮助。

多选项似乎不太合适。然后再次在#属性下使用它。这将导致html元素有一个attribute倍数,但我在/modules/file/file.js中没有看到任何东西能够理解这一点,所以这大概就是为什么它是。 正如建议的那样,您最好使用plupload