1

I have a problem uploading files using Sonata Media. I have configured the sonata media providers follows:

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']

But when I try to upload a CSV or an Excel file using this:

    ->add('file','sonata_type_model_list', array('required' => true), array(
        'link_parameters' => array(
            'context' => 'default',
            'provider' => 'sonata.media.provider.file')))

The file is uploaded as .bin instead preserving the correct extension. What am I doing wrong?

Thanks

Gerardo
  • 5,800
  • 11
  • 66
  • 94

1 Answers1

0

I succeeded in fixing it by installing zip php extension

docker-php-ext-install zip

and adding tis line to my code

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

this link may help you

Community
  • 1
  • 1