如何使用 drupal 7 上传多个文件? [英] How can I upload multiple files with drupal 7?

查看:14
本文介绍了如何使用 drupal 7 上传多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个包含表单的 drupal 7 模块,我想连续上传多个文件.目前我正在使用 managed_file 类型的输入字段.

I'm making a drupal 7 module that contains a form and I would like to upload multiple files in a row. Currently I'm using a managed_file type of input field.

$form['attachment'] = array(
                            '#title' => t('Attachment'),
                            '#type' => 'managed_file',
                            '#default_value' => variable_get('attachment', ''),
                          '#upload_location' => 'public://perm/',
                            );

这给了我上传按钮,但只允许我上传一个文件.有没有办法让这个表单上传文件,并且仍然保持第二次上传的选项打开?

This gives me the upload button, but only lets me upload one file. Is there a way I can tell this form to upload a file and still keep the option for a second upload open?

推荐答案

查看新的 ajax 系统,它很容易实现,它应该允许您在选择文件后触发 ajax 回调以添加额外的文件字段动态地输入表单,只需谷歌drupal 7 ajax",你会发现几十个例子

check out the new ajax system, it's pretty easy to implement, it should allow you to trigger an ajax callback once the file has been selected to add additional file fields to the form dynamically, just google "drupal 7 ajax" and you'll find dozens of examples

这篇关于如何使用 drupal 7 上传多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆