You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 11.5表单文件上传添加zip允许类型的配置求助

TYPO3 11.5 添加ZIP为表单文件上传允许类型的正确配置

你的问题出在直接覆盖了默认的允许MIME类型列表,只保留了zip,而非在原有列表基础上添加。同时需确保配置的继承逻辑正确,以下是两种可行方案:

方案1:全局修改FileUpload元素配置(所有表单生效)

  1. 保留你在模板配置中的plugin.tx_form.settings.yamlConfigurations设置,序号大于默认的10即可(你当前的10002345234符合要求)。
  2. 修改对应的FileUpload.yaml文件,使用_inherit: true继承默认配置,然后追加zip类型:
FileUpload:
  _inherit: true
  properties:
    allowedMimeTypes:
      # 原有默认允许的MIME类型
      - application/msword
      - application/vnd.openxmlformats-officedocument.wordprocessingml.document
      - application/vnd.ms-excel
      - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
      - application/pdf
      - text/plain
      - application/vnd.oasis.opendocument.text
      - application/vnd.oasis.opendocument.spreadsheet
      # 添加ZIP类型
      - application/zip
    # 保留你的自定义样式/存储配置
    containerClassAttribute: input
    elementClassAttribute: ''
    elementErrorClassAttribute: error
    saveToFileMount: '1:/user_upload/'

方案2:针对单个表单的上传字段配置(仅目标表单生效)

如果不需要全局修改,可直接在目标表单的YAML配置中指定该上传字段的允许类型:

type: Form
identifier: your_form_identifier
label: Your Form
elements:
  -
    type: FileUpload
    identifier: file_upload_field
    label: Upload File
    properties:
      allowedMimeTypes:
        - application/msword
        - application/vnd.openxmlformats-officedocument.wordprocessingml.document
        - application/vnd.ms-excel
        - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
        - application/pdf
        - text/plain
        - application/vnd.oasis.opendocument.text
        - application/vnd.oasis.opendocument.spreadsheet
        - application/zip
      saveToFileMount: '1:/user_upload/'

关键步骤:清除缓存

修改配置后,必须在TYPO3后台执行清除所有缓存操作,确保新配置生效。

内容的提问来源于stack exchange,提问作者MarioProject

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 14:16:13