【问题标题】:Drupal 7.31 custom file field and it's extensionsDrupal 7.31 自定义文件字段及其扩展
【发布时间】:2014-10-08 12:49:20
【问题描述】:

我的自定义节点类型的自定义创建字段有问题。这是字段实例配置:

'attachments' => array(
    'field_name'     => 'vintranet_talk_attachments',
    'label'          => t('Attachments'),
    'entity_type'    => 'node',
    'bundle'         => 'mynodetypename',
    'widget'         => array(
        'type' => 'file_mfw',
    ),
    'settings'       => array(
        'max_filesize'       => 1024 * 1024 * 10,
        'file_directory'     => 'my/path',
        'file_extensions'    => 'jpg,png,gif,pdf,zip,doc,rtf,xdoc,rar,txt',
        'description_field'  => 1,
    ),
    'display'        => array(
        'default' => array(
            'type' => 'file_table',
        ),
    ),
),

安装我的模块后,我想添加新节点并添加一些附件,但我收到此错误:

为什么我无法上传我的*.txt 文件(与jpg 和其他文件相同),即使我在“允许的文件类型”列表中有此文件格式?

只有在从后端页面编辑特定节点类型字段设置后(只需按“保存”按钮),一切正常...

【问题讨论】:

    标签: file drupal drupal-7 field


    【解决方案1】:

    答案是将file_extensions 的值更改为jpg png gif pdf zip doc rtf xdoc rar txt

    【讨论】:

      猜你喜欢
      • 2014-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多