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 - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

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