【问题标题】:Get mime type with Gaufrette and Vich uploader on Symfony2在 Symfony2 上使用 Gaufrette 和 Vich 上传器获取 mime 类型
【发布时间】:2013-12-12 14:22:58
【问题描述】:

我有问题。我使用带有 Vich 上传器的 gaufrette 并向我的 VichUploadable 实体添加 $file 属性。

我做了配置,上传文件效果很好。

但是当我想获取文件的 mime 类型时(通过文件上传后的实体),由于 Gaufrette 使用的文件名格式,我收到错误。

当我尝试执行“$myEntity->getFile()->getMimeType()”,其中 getFile 返回 Vichuploadable 的文件对象时,我收到此错误:“无法找到包装器 \"gaufrette\" -你是不是在配置PHP的时候忘记开启了?”

您对我如何拥有 mime 类型有任何想法吗?

谢谢

【问题讨论】:

    标签: symfony mime-types gaufrette vichuploaderbundle


    【解决方案1】:

    必须启用 Gaufrette 流包装器才能使其工作:

    knp_gaufrette:
        stream_wrapper: ~
        # ...
    

    【讨论】:

      猜你喜欢
      • 2017-03-18
      • 2011-07-03
      • 2013-05-24
      • 2012-04-16
      • 2018-04-08
      • 2013-01-05
      • 2021-11-15
      • 2011-05-08
      相关资源
      最近更新 更多