Symfony Sonata管理员-CSV和Excel上传为.bin

Symfony Sonata管理员-CSV和Excel上传为.bin,symfony,sonata-admin,symfony-sonata,Symfony,Sonata Admin,Symfony Sonata,我在使用Sonata Media上传文件时遇到问题。我已将sonata媒体提供商配置为: providers: image: resizer: sonata.media.resizer.fixedresizer file: allowed_extensions: ['pdf', 'txt', 'rtf', 'doc', 'docx','xlsx', 'xls', 'xlsx', 'ppt', 'pttx', 'odt', 'odg', 'odp',

我在使用Sonata Media上传文件时遇到问题。我已将sonata媒体提供商配置为:

providers:
    image:
        resizer: sonata.media.resizer.fixedresizer
    file:
        allowed_extensions: ['pdf', 'txt', 'rtf', 'doc', 'docx','xlsx', 'xls', 'xlsx', 'ppt', 'pttx', 'odt', 'odg', 'odp', 'ods', 'odc', 'odf', 'odb', 'csv', 'xml','numbers']
        allowed_mime_types: ['text/csv','application/pdf', 'application/x-pdf', 'application/rtf', 'application/octet-stream', 'text/html', 'text/rtf', 'text/plain','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-excel','application/x-iwork-numbers-sffnumbers','application/vnd.apple.numbers']
但当我尝试使用以下方法上载CSV或Excel文件时:

    ->add('file','sonata_type_model_list', array('required' => true), array(
        'link_parameters' => array(
            'context' => 'default',
            'provider' => 'sonata.media.provider.file')))
文件上载为.bin,但保留了正确的扩展名。我做错了什么


谢谢

我通过安装zip php扩展成功地修复了它

docker php ext安装zip

并将这一行添加到我的代码中

PHPExcel_设置::setZipClass(PHPExcel_设置::PCLZIP)


这可能会帮助您

我通过安装zip php扩展成功地修复了它

docker php ext安装zip

并将这一行添加到我的代码中

PHPExcel_设置::setZipClass(PHPExcel_设置::PCLZIP)

这可能对你有帮助