如何使用 drupal 7 上传多个文件?
我正在制作一个包含表单的 drupal 7 模块,我想连续上传多个文件。目前我正在使用 Managed_file 类型的输入字段。
$form['attachment'] = array(
'#title' => t('Attachment'),
'#type' => 'managed_file',
'#default_value' => variable_get('attachment', ''),
'#upload_location' => 'public://perm/',
);
这给了我上传按钮,但只允许我上传一个文件。有没有办法让我告诉这个表单上传文件并仍然保留第二次上传的选项打开?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看新的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
您检查过这是否是您所需要的吗? http://drupal.org/project/multiupload_filefield_widget
have you checked to see if this is what you need? http://drupal.org/project/multiupload_filefield_widget