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

查看:310
本文介绍了如何使用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天全站免登陆