symfony - Symfony2, get file type from request -


I have a form in my template with a file input.

In my Controller, I can retrieve $ request- & gt; File-> Receive (my file with 'file'); But how can you get the type?

Is there any way with Symphon 2?

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

Popular posts from this blog

mysql - where clause in inner join query -

php - MySQL Query for Advanced Search multiple criteria -

java - Why my included JSP file won't get processed correctly? -