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

php - How can I cram 6+31 numeric characters into 22 alphanumeric characters? -

mysql - where clause in inner join query -

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