symfony - Validation for csv files which is exported from Excel -


I create a barrier in Symphony if the uploaded file was a CSV file.

  $ FileContrains = new file (array ('maxisiz') = & gt; 2m ',' mimetype '=> array (' text / csv ',' text / plain ')));  

If I am uploading a CSV file that is exported from the extract, verification fails. I check the mime type which was posted

  object (Symphony \ Partition \ HTP Foundation \ file \ uploaded file) [12] Private 'Test' => Boolean false private 'title' = & gt; String 'Export-201141027.csv' (Length = 19) Private 'Mimetype' = & gt; String 'app / vnd.ms-excel' (length = 24) Private 'size' = & gt; Int 120634 Personal 'Error' = & gt; Int 0  

and then I check the mime type file on the server

  file -b --mime & lt; Filename & gt;  

and go as ouptut

  text / plain; Charset = utf-8  

Output file types are different from PHP and Console.

How can I handle it to get the correct mime type recognition of my post


Comments