Get mime type with Gaufrette and Vich uploader on Symfony2

1.2k views Asked by At

I have a problem. I use gaufrette with Vich uploader and add a $file attribute to my entity that is VichUploadable.

I did the configuration and the upload of files works well.

But when I want to get the mime type of the file (via the entity after the file has been uploaded) I get an error due to the file name format that Gaufrette use.

When I try to do "$myEntity->getFile()->getMimeType()" where the getFile return the File object that is Vichuploadable, I get this error : " Unable to find the wrapper \"gaufrette\" - did you forget to enable it when you configured PHP?"

Do you have any idea on how I can have the mime type ?

thank you

1

There are 1 answers

0
K-Phoen On

Gaufrette stream wrappers must be enabled for this to work:

knp_gaufrette:
    stream_wrapper: ~
    # ...