symfony - Symfony2, get file type from request -
I have a form in my template with a file input.
In my Controller, I can retrieve Is there any way with Symphon 2? $ request- & gt; File-> Receive (my file with 'file'); But how can you get the type?
get () function FileBag class will throw you if an object is returned lands (or if there is an error.) you can get the mIME type of the file:
$ file = $ request- & gt ; File-> File '); $ Type = $ file- & gt; GetMimeType ();
Comments
Post a Comment